Layout for touch screen application - java

I have to develop a touch screen application based on swing for the GUI part.
The application will have to be displayed on different screen, one 15" 4/3 screen and one 20".
What kind of layout stategy should i go for, to keep the same proportion in my components from one screen to another ?
The application will have a kind of status bar at the top displaying some information coming from a server, a menu bar at the bottom, the main central part of the application will display graphs, and on the right an area that will display the same information as the graphs, but in digital format. Buttons from the menu bar and labels in display/status bar have to be quite big as the users that will play with the screen may wear gloves...
Thanks you for help.

any specific layout manager is not gonna do the trick....Handling the window size is not a problem as that can be taken care of (use ToolKit for that). Only problem is that u gotta make sure that, the component sizes are not fixed, cos when screen size changes that gotta change as well. This is a peculiar problem, lot of trail and testing may be required.

Related

Creating a transparent, scrollable, flingable list without passing in a ScrollView for Android

I'm creating a platformer game for Android. However, I'm trying to overlay a transparent, scrollable list of text and (small) images in the title screen, outside of the game. Since the title screen was written in pure Java without the aid of XML, I'm looking to avoid passing in a ScrollView and changing the game's activity. Normally, I would build my own scroller programmatically, but I want my users to be able to fling the list to scroll, which I would have trouble implementing. So I was wondering if there was something for me to use. Also, I was wondering how other mobile games handle scrolling objects vertically with flinging? Do they build it themselves? Unfortunately, I can't think of a good example right now.
I'm looking to make the scrollable list transparent, so I can overlay it across a background image. Here is my title screen:
Title Screen
For example, when the credits button is pressed, the list will appear, overlaying an image in the background. (I haven't made the background image yet).
Sorry for the long post, or if this didn't make sense at all.

Draggable border to resize view

The past few months I've been on a mission to implement widget support in my home screen replacement for Android, and it's proving rather difficult. I can now add and remove widgets to/from the home screen, but they can't be resized or moved yet. Currently what I'm trying to achieve is to resize them. To do this I have every widget embedded in a View, over which I put an overlay to make sure the touch events don't get caught by the widget underneath it (which caused trouble in past attempts).
What I have now is this layout for the container; http://www.hastebin.com/uwocaxukel.xml
The widget is put in the FrameLayout with id widgetContainer. As you can see in the screenshot below there is an orange dot in the middle of every border.
Now what I've always tried to do so far is catch touch events, figure out whether the user is trying to drag one of the borders (MotionEvent.ACTION_MOVE), and if he is, change the required properties in the LayoutParams object and call this.requestLayout () on the view. This is finicky, and less than ideal. Very often the touch events would stop registering because the user dragged faster than the view could refresh = user is no longer on the view which is listening for touch events, or the border would be too thin to hit.
So far it's all been very finicky. But there are other apps which seem to do this pretty much perfectly. Is there a library, a class I've overlooked, or something else I can use to achieve my goal?
This is an example of something that kind of worked, but was very finicky and just not remotely user-friendly; https://github.com/RobinJ1995/be.robinj.ubuntu/blob/869d48af2e7a3d8f0332f84edd2a8cd28564424a/UbuntuLauncher/app/src/main/java/be/robinj/ubuntu/widgets/WidgetHostView.java#L75

How to create a customizable User Interface with swing

I've searched through google, but there doesn't seem to be anything on this. In almost every user interface, you can resize parts of it in order to make it more custom (from the users perspective). For instants, in eclipse, one can resize the consul relative to the area with the code by clicking on the spot in-between the two panels/parts and dragging. One can also click and drag the area in between the Package Explorer and the rest of the parts in order to resize that. How would I do this? By "this", I mean allow users to resize the amount of space given to each part of the layout? How do I get the little division-sign-like curser to show up? What layout should I use?
You seem to be describing a JSplitPane.
Take a look at How to use Split Panes for tones of examples

Limiting a window drag movement in Vaadin

I have a Vaadin application which contains a header and a menu bar as well. The menu bar provides options where some of which opens up a new Window much similar to a desktop MIDI application. However the window can be moved above the menu and over the header. Does anyone know how it is possible to limit the view movement to within the content area. This content area is currently a VerticalLayout.
There is no built-in way for doing this. I think you have couple of options:
Implement a callback that moves the window to right place after the drag. This is not optimal for usability as it makes the window jump around.
Create / extend the Vaadin's (sub-)Window drag handler to and apply limits there. Unfortunately, this is not as easy as it could be, because you have to tinker with the browser's events directly.

How to create multiple screens in Java?

I have been playing around with trying to get a menu screen for my game. I have only been able to figure out how to paint a new Screen on top of an existing one; meaning that the actual game is still running behind the title screen. I don't need actual code but just a description of how I would go about this.
One way to display a menu would by by using a JDialog outside of your main application window. Take a look at the How to Make Dialogs tutorial for more information.
Another possibility would be to use JInternalFrame for your game and menu so they can be wrapped in a larger application frame. These are explained nicely in How to Use Internal Frames

Categories