• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unevenly laying out a JFrame

 
Richard Woodward
Greenhorn
Posts: 3
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey all,

I currently have a frame with two JPanel's placed upon it side-by-side (vertically) by using GridLayout:

On my left panel I have a couple of JLabels, a JProgressbar, and a JTable. On the Right I have a JButton.
However, this split of the frame has given equal amount of space for both panels (as you would expect).
I wish to make the right panel much smaller than the left so that the left panel dominates the frame space (around 3:1).
How can this be done? I've been looking around and noticed JSplitpane but that only really seems helpful when you're using one panel.

Cheers,
Ritchie
 
Rob Spoor
Sheriff
Pie
Posts: 20368
43
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about a BorderLayout, with the right panel added with BorderLayout.EAST (meaning it will only get its preferred size) and the left panel with BorderLayout.CENTER (meaning it will take up all remaining space)?
 
Richard Woodward
Greenhorn
Posts: 3
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's done the job! Nice one, Rob

Cheers,
Ritchie
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic