File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Layout Management Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Layout Management" Watch "Layout Management" New topic
Author

Layout Management

Sam Jason
Greenhorn

Joined: Apr 09, 2002
Posts: 6
hi guys,
I have completed my GUI design but there are still sth confused about layout management. In the main jframe, I use a jpanel to include all the components (JButton, JLabel, JCombox) except the JTable, and add this jpanel to the jframe's
BorderLayout.NORTH, and add the jtable to the
BorderLayout.CENTRE. since the jpanel use the FlowLayout, when i mininize the JFrame, the representation of the JPanel will get mess up(some component just disappear since the jpanel don't resize itself in the v way). I want to use
the GridBagLayout for that but it is a little complex and not easy to extend (imagine i have to add new components to the jpanel in furture, i have to modifiy a lot).
any suggestion about the layout design?
thanks
Leonardo Wang
Greenhorn

Joined: Feb 19, 2002
Posts: 17
You can change the default layout(FlowLayout) to BorderLayout to fix the position of component.
I use a series of JPanels with BorderLayout in stead of GridbayLayout to control the position of components.
Hope this helps
Abhinav Anand
Ranch Hand

Joined: May 02, 2002
Posts: 113
Hi,
Although GridBagLayout is a bit tough to use, but it provides a lot of control over the appearance of your components. So I have used it as the main way of placing components in the main client panel. Just try it once. Once you get a hang of it, you will find out that the benifits of using GridBagLayout far outweights it's complexity.
Thanks,
Sai Prasad
Ranch Hand

Joined: Feb 25, 2002
Posts: 560
I believe starting jdk1.2, default layout is BorderLayout for JPanel. Sam, I suggest adding another panel to include the JScrollPane which contains the JTable.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Layout Management