java swing question...getting labels to "stick" next to each other

ThisIsMatt

Banned
Aug 4, 2000
11,820
1
0
Developing a program (game) for school and we can't figure this out. We have a panel with a grid of JLabels (in a grid layout) with no text, just image icons. Currently we're restraining the main frame to a certain size, which keeps the grid panel restrained and looking the way we want it (like this). However, if we allow the frame to be resizeable, the panel with the grid will spread out and look like this. It would be very helpful if we could allow the frame to be resizeable without allowing the inner grid panel to be resizeable.

We've tried using the setMaximumSize(Dimension maximumSize) method on the component, but that seems to do nothing.

What else could we try to either make the panel itself not resizeable or make it so the labels don't come appart?

Thanks for any help
-matt
 

m0ti

Senior member
Jul 6, 2001
975
0
0
if you've got one frame inside the other, just set the outer one to be resizable, and the inner one to be not resizable. It should work.