Results 1 to 5 of 5
- 02-16-2009, 02:01 PM #1
Member
- Join Date
- Feb 2009
- Posts
- 38
- Rep Power
- 0
[SOLVED] Possible to have two BoxLayout in same area of BorderLayout?
Hello
This is another problem I am having with the GUI of my program. Basically, I have a class called MainInterface, it is a JFrame built from BoxLayout components inside a BorderLayout.
Forexample:
As you can see, the buttons ect inside Jpanel top are laid out along a Y_AXIS. Is it possible to have two BoxLayouts, one Y_AXIS the other X_AXIS both within the PAGE_START of the BorderLayout?Java Code:JPanel top = new JPanel(); top.setLayout(new BoxLayout(top, BoxLayout.Y_AXIS)); .... Container contentPane = getContentPane(); contentPane.add(top, BorderLayout.PAGE_START);
Thank youLast edited by mainy; 02-16-2009 at 03:16 PM. Reason: Grammar mistakes
- 02-16-2009, 03:23 PM #2
BoxLayout seems to be intended to allow you to put boxes in boxes. Try that.
- 02-16-2009, 03:57 PM #3
Member
- Join Date
- Feb 2009
- Posts
- 38
- Rep Power
- 0
Hi Steve.
Thank you for your input. I have checked the Java swing references and I believe you are right. I got a test now but once I get back I'll give it a go. If I come across any problems Ill post them up.
Thank youLast edited by mainy; 02-16-2009 at 04:01 PM.
- 02-16-2009, 04:17 PM #4
All container-type components have an add() method.
Each time you create a component, you should assign it to a instance field so you can keep track of it.
Add the JPanel to the content pane.
Add the first box to the JPanel
Add two more boxes to the first box.
Add components to the boxes.
- 02-16-2009, 09:52 PM #5
Member
- Join Date
- Feb 2009
- Posts
- 38
- Rep Power
- 0
Similar Threads
-
BorderLayout Demo
By Java Tip in forum SWTReplies: 0Last Post: 07-11-2008, 04:51 PM -
Area Add
By Java Tip in forum java.awtReplies: 0Last Post: 06-22-2008, 11:07 PM -
Area Intersect
By Java Tip in forum java.awtReplies: 0Last Post: 06-22-2008, 11:07 PM -
Print Area
By Riftwalker in forum Advanced JavaReplies: 0Last Post: 11-28-2007, 07:28 PM -
Help with BorderLayout
By lenny in forum AWT / SwingReplies: 1Last Post: 07-31-2007, 07:26 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks