• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GridBagLayout problem

 
kevin chang
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used a JFrame includeing a Container, thus ,I set Container with GridBagLayout,but it seems that I even can't put the JToolBar at the top of the Container. it always at the center of the Container. I already use the GridBagConstraints, but it didn't affect too much. I got confused about the GridBagConstraints.
how should i set the gridx,gridy,gridweitht,gridheight,weightx,weithty,fill,anchor to make sure the toolbar is at the top of the Container, my ComboBox Panel is under that, my JTable Panel is under the ComboBox Panel!
thanks!
 
Burk Hufnagel
Ranch Hand
Posts: 814
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you want to have an outer panel for the JToolbar and use a BorderLayout so it can dock to any of the sides.
Then add your panel with the GridBagLayout in to the outer panel using BorderLayout.CENTER and you should be Ok.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic