• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

arranging display in a panel with grid bags...

 
achana chan
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
I have done a setLayout(new GridLayout(2,2)) in order to get 4 panels. 2 rows by 2 columns.
In the row1/col1 (NORTHWEST) is a block of data in tabular format.
In the row1/col2 there should be an image.
In row2 there should be a text area spanning both columns.
Somehow, my current arrangement has got a bit of the image displayed on the right hand side of row 2 text area.
How do I force the image to display in a panel in row1/col2 ???
Yes doing it right the first time is diffcult, after that, I get remarks from colleagues reading and copying my codes, saying "...that looks easy, I knew that... ".
***************
Basically, if I have a 3x4 grid than how do I ensure that panel ABC is in row1, col2 ???
***************
Arrrgggh, all these books have such simple examples, like setLayout(new GridLayout(1,2)).

[ December 10, 2002: Message edited by: achana chan ]
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of using GridLayout, you should be using GridBagLayout...

Here's a short example showing a frame layed out like you described...

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic