Java help!

jamesbond007

Diamond Member
Dec 21, 2000
5,280
0
71
Hey everyone! I'm writing a pretty nifty pizza POS (point of sales) program and am having troubles with my panels. The main frame layout is of grid type, but I was wondering if there's a way to specify the height of each panel. As you can see here, the Size and Crust panels are very tall; much taller than they should be.

I've tried things like panelName.setPreferredSize(new Dimension(500,50)); but that doesn't work. My window is 500x600, for reference.

The picture on top is just for filler so just ignore that. ;)

Thanks for any input!

EDIT: The size and crust sections are of FlowLayout type.
 

mundane

Diamond Member
Jun 7, 2002
5,603
8
81
GridLayout makes all cells the same size. BoxLayout should allow you to make a column and each component will obey its preferred / max / min size. I usually use GridBagLayouts and nested JPanels for fine-grained control over layouts.