In a Codename One GUI builder app when I navigate back to my Main form, the screen is always shown at the top.
How can I get the screen to auto scroll down to the part I want and retain its previous scroll?
I'm assuming that this is a GUI builder app.
Normally this should be seamless as the UI will scroll to the last focused component but if you don't have focusable elements this might be harder. You can store the scroll Y value on the exitForm event and restore it the beforeShow event using something like:
f.addShowListener((e) -> f.scrollY(yValue));
Related
I want to simulate basic input for a swing application. The whole thing runs headless and doesn't even have a JFrame. I just render all components from the JPanel using the draw() method on a Image (If you want to know why: The Image gets rendered on minecraft maps where users then should be able to interact). I want to execute click or scroll actions on the panel like it would come from regular user.
I know that I can simulate a Button click using doClick() but this doesn't work for components like checkboxes. I also tried using dispatchEvent() but that didn't fire the animations or on some components even threw a HeadlessException.
I'm currently developing the menu of my application and I would like to know what's the proper way of coding a "stage based menu". What I mean by stage based menu is that, user clicks a button, the entire interface changes to the next "stage". Here are the pictures I designed in Photoshop in order to explain my idea:
First picture would be the first stage and the second picture the second.
Each round looking thing is a JButton
So far I got the main menu (fist picture) made on eclipse using WindowBuilder, made it as a JPanel and then I instantiate it on the window class.
My idea was to have an event listener listen for clicks on each button and then once the even is triggered, have the JPanel variable on the frame change to the next "stage". So I was wondering if this is actually the proper way of doing this or are there any better ways?
You could use a Card Layout to make it easy to swap panels.
Check out the section from the Swing tutorial on How to Use Card Layout for more information and examples.
I'm trying to create an universalish tab widget in libGDX. It contains a button bar and a pane bar and a pane view.
Lets assume the tabwidget is as big as the screen, and we have 3 tabs. The buttonbar takes up the top part of the screen, and the panes are in the bottom part. The paneView is a WidgetGroup for event handling, it is as big as the tabwidget minus the buttonBar.
Everything works just fine until I add an a scrollpane as a tab widget. Since this scrollPane calls:
event.stop();
the subsequent events are not called.
Since events "bubble" up through actors, the lowest level actor is handled first calling the event handlers of its parents and siblings upwards. This means the scrollpane is always handled before the tabwidget.
Is there a way to intert the order of the input listeners? Have the tab input be handled first and then the scrollpane input? Or will I have to reimplement the scrollpane handlers to get around this issue?
I think that the way you want to implement this is rather impossible - how actors would know if the fling gesture you are performing is addressed to which?
The resolution that comes to my mind is to
Create new stage being input processor (if it will be second inputProcessor you will need InputMultiplexer )
Implement GestureDetector and then detect horizontal swipes and react with moving group - read this tutorial to get more information
In my opinion it is generally not good idea to modify libgdx sources but of course you can do it (by downloading LibGDX from Github and import it as project you will have access to all sources) although in this case it is definitely unnecessary.
I am creating a panel showing many different kind of widgets such as button. The panel allows to zoom in and zoom out. It is required to show whole panel in the beginning. However, some users may touch more than one button when the panel is too small.
I want to handler the situation like chrome in Android. When the user touches more than one link, a pop up panel will be showing.
What library or APIs may I use?
Thanks!
You could place your Buttons in a FocusPanel implementing a ClickHandler to open your desired popup- thus when your user clicked between two buttons the click is registered and you can handle it.
Note, you will have to place a FlowPanel in that FocusPanel to place more than one button inside.
If you want to react on hover instead of on click, use HoverHandler instead.
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