• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Layout Management

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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,
 
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic