Results 1 to 7 of 7
Thread: Panel and Gui Question
- 06-16-2011, 06:02 AM #1
Panel and Gui Question
So as I'm exploring the wonderful world of swing and awt in my books I came to something not really covered by the book or in any article I've come across in Google that wasn't restricted. My book has always shown code that goes in a certain order for adding things to a frame. ie.
Make Frame
Set Frame Options
Make Panel
Make Components
Add Components to Panel
Add Panel to Frame
However in some partial code where they are explaining how to set the layout manager of a panel they showed these steps in this order.
Make Panel
Make Components
Add Panel to Frame
Add Components to Panel
My question is, as I assume the book is not incorrect, is there more or less a rather free flow of order in which you are to configure the end gui user interface? Also if anyone knows of a good article that explains this a little more deeply I would be much obliged. Unfortunately I'm on highly restricted internet so I have little hope for actually finding one.- Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
- +Rep people for helpful posts.
- 06-16-2011, 06:12 AM #2
Yeah there is a bit of leeway in what order things happen. The only thing that does matter is you should make a call to setVisible (and possibly pack) last or as close as. Otherwise things may not be displayed correctly
- 06-16-2011, 06:14 AM #3
Ok, but as long as everything else is added in the order I want them to be added into panels it doesn't matter if I add the panel before or after the frame. Got it.
Thanks for clearing that up, it makes everything a little bit easier.- Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
- +Rep people for helpful posts.
- 06-16-2011, 06:19 AM #4
Be careful though. If you add things willy-nilly then your code will be hard to read. Try to organise it into logical sections as much as possible.
- 06-16-2011, 06:27 AM #5
Indeed, I wasn't planning on throwing code around just because I could. Modern artistic expression isn't so much appreciated in the code world I guess
.gif)
P.S. Did they remove the Mark this thread as solved from the forum options?- Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
- +Rep people for helpful posts.
- 06-16-2011, 06:33 AM #6
Yeah apparently it got "lost" in the last upgrade.
- 06-16-2011, 06:33 AM #7
Similar Threads
-
panel on a panel not visible
By warchieflll in forum Advanced JavaReplies: 2Last Post: 01-29-2011, 08:29 PM -
Add panel to parent panel
By LovJava in forum AWT / SwingReplies: 10Last Post: 09-02-2010, 08:43 PM -
Panel in a panel?
By pahiker in forum AWT / SwingReplies: 1Last Post: 07-05-2010, 11:42 AM -
Adding a panel to a panel
By rclausing in forum New To JavaReplies: 7Last Post: 02-02-2010, 05:56 AM -
add image on panel
By samiksha.goel in forum AWT / SwingReplies: 4Last Post: 08-02-2008, 07:38 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks