• Post Reply Bookmark Topic Watch Topic
  • New Topic

Basic Question about JTable

 
don cline
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a pretty basic question.

I placed a JTable inside a JPanel associated with a GridBadLayout
manager. Even though I set the size of the JTable with setSize(int,int)
the JTable ends up tiny.

How do I control its size? There is plenty of room on the JPanel.

Don
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One way with GridBagLayout is to set both weightx and weighty constraints to non–zero and set the fill constraint to GridBagConstraints.BOTH. This will allow the JTable to expand to fill the space available to it in the JPanel.
 
don cline
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!