I am trying to create a movie credits style scrolling animation to add to the end of the game demo I have made. I was wondering if there is any way to do this using Java SE without any third party libraries. Any help is useful. Thank you.
Yes it's possible. If a Swing GUI, you can place the text in a JTextArea, place that in a JScrollPane without scrollbars, and simply scroll the JScrollPane. If not a Swing GUI, then you will want to give us more information.
Related
I'm not very experienced with Java Swing Layouts. I'd like to make a layout looking like the one in the picture. Is there any easy way to understand and create layouts?
There are tutorials on the oracle website and there are wysiwyg layout-building tools that show you interactively what you are building. One of them I have personally used in the past is the Window Builder you can get as an eclipse plugin but it is by no means the only one.
In the end though what it comes down to is experience. Fool around with them, try them out, get to know them. If you dont code with them yourself it is difficult to understand them properly.
Is there any easy way to understand and create layouts?
I cannot judge what others would find easy, but my approach to laying out containers is to look for sub-sections of the GUI that would be easily done with a particular layout, then working outwards from that.
For example, it seems a single row GridLayout might be well suited to displaying the top two text panes. Then the rest of the GUI can be created by placing the panel with the two text panes into the PAGE_START constraint of a BorderLayout, with the third text pane in the CENTER and the text field in the PAGE_END.
Done.
I am stuck trying to make the following kind of slide menu in Swing.
I have searched entire web but I didn't find any tutorial or maybe I missed that. Can you please suggest a solution or a tutorial? I don't need code but just the components to use.
This is very simple in Swing.
What you are looking for is a JSplitPane. You can start with it closed and it has arrows (or other symbols depending on your look and feel) that can be clicked on.
http://docs.oracle.com/javase/tutorial/uiswing/components/splitpane.html
Note: A slider is a very different component. (http://docs.oracle.com/javase/tutorial/uiswing/components/slider.html)
Edit: Based on your comment it sounds like actually are looking for an animated opening of the slider (which is hard to tell from a static image).
In that case this question is a duplicate, look here: Animation for divider movement in JSplitPane
I'm writing a simple text editor in java, I have done it before now I have some new ideas, normally when I put in a JTextArea when I have a FlowLayout on my JFrame it will fill what is left of the JFrame. However this time it's not. Could someone help me out trying to get it to fill the rest of my JFrame? Thanks!
http://docs.oracle.com/javase/tutorial/uiswing/layout/layoutlist.html
Java does have various layouts. For making dynamic body changes you have to learn more flexible layouts like grid or grid bag layout. Hope this help.
I have been working on my assignment and I need a help regarding which layout to choose while designing the label combo box and buttons using java GUI. I want things to be done in a particular manner where in one horizontal line I need labels followed by combo box followed by button in second horizontal line I want the same things with one extra button and so on for third and fourth horizontal line. Actually my concern is that I am very much new to GUI and I need a suggestion which layout to choose and how to implement it
thanks in advance
I would go with GroupLayout (use NetBeans, it has a very good GUI builder, that makes UI creation easy). If you want to try more sophisticated solution, you may check JGoodies or MigLayout.
Assume that the back is using a JTextPane, and I would like to implement a view with a label. But how can I implement the view in Java? is that something like UIView on iPhone on the Java Swing? Thanks.
If I understand correctly, you would like to display a JLabel on top of a JTextPane. If so, use a JLayeredPane.
Read the Swing tutorial on layered panes to learn how to use them.
Are you looking for something like this?
See Twinkle
There's nothing special about this; just pack an extra JPanel along the bottom of your window, and put a JLabel into it; set the text of the JLabel as needed.