Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to set the cell size in grid layout where each cell is a panel

843807Mar 23 2006 — edited Jun 6 2006
Hi,

I am using a grid layout where each cell is a panel. Here I want to
set size of each panel to be equal irrespective of any. But it is not obliging the setSize().

no of row in grid - 4
no of columns - 4

each cell is a panel. each panel has a label.

panel.setSize(parent.getWidth(), parent.getWidth()/4); // not working. Size is adjusting to the length of the label.

I want to force the size of the panel to our preferred size.

Note: In swing we can use JPanel.setPreferredSize(). Unfortunately I cannot use Swing components. Requirement is awt only.

Any help in this is highly appreciated.

Thanks
Kishore
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 4 2006
Added on Mar 23 2006
3 comments
905 views