Results 1 to 5 of 5
Thread: Components Layout in a JPanel
- 10-11-2009, 01:37 AM #1
Member
- Join Date
- Aug 2009
- Posts
- 56
- Rep Power
- 0
Components Layout in a JPanel
Hi,
Could someone tell me how to assign a specfic layout to each component in a Panel? For example, if I want to display something as follows using Box class:
.....Name......
[..............]
[ ...... ] age
[ ...... ] ID
Where the brackets are the textfields and dots are spaces.
Which methods are out there to change to this layout? Can anyone give a very good source to refer to?
Thanks heaps.Last edited by jboy; 10-11-2009 at 01:40 AM.
-
You will often use nested layouts; that is several JPanels, some nested inside of others, each using their own layouts. Popular layouts include the Sun Swing (or AWT) layouts which you can read about here: Lesson: Laying Out Components Within a Container (The Java™ Tutorials > Creating a GUI With JFC/Swing)
Also, there's the MigLayout which you can read up on here: MiG Layout Java Layout Manager for Swing and SWT
- 10-11-2009, 08:55 AM #3
Member
- Join Date
- Aug 2009
- Posts
- 56
- Rep Power
- 0
I have now decided to manage my layout using the GridBagLayout, the problem is I don't know how to add a text field and two radio buttons on the first row and a text field and two radio buttons on th second row without any borders. So it is actually one panel with 6 different components. How can I set their position for each on the panel?
Thanks!
-
For general questions on how to use this complex layout, I doubt any of us can explain things better than is already done in the tutorial. You can find this tutorial by going to my first link above. Please give it a read, and then give it a try. Much luck.
-
Similar Threads
-
Layout problem / add components from another class
By ehochedez in forum AWT / SwingReplies: 9Last Post: 09-02-2009, 10:42 AM -
How to place components on JPanel
By deshprateek in forum AWT / SwingReplies: 1Last Post: 02-22-2009, 05:34 AM -
Inconsistent layout w/dynamic resize of components
By donb2000 in forum AWT / SwingReplies: 3Last Post: 07-26-2008, 02:40 PM -
JPanel / layout problems
By Warhorsei in forum AWT / SwingReplies: 4Last Post: 06-04-2008, 05:26 AM -
Removing components from JPanel
By Echilon in forum New To JavaReplies: 0Last Post: 12-30-2007, 04:05 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks