This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
I'm still getting used to layout managers etc, I have a JPanel that is quite large in size, I'm wanting to add another panel to it that looks something like below (the contents of the frame)
However when I add this Panel to a bigger Panel, it screws it
And here's the pretty simple test code I've been using
When you add the panel to a BorderLayout the size of the component is automatcally changed to take up all the space in the BorderLayout. Since a GridLayout also expands to take up all the space all the components get resized. You can prevent this by wrapping your panel into another panel that uses a layout manager that respects the preferred size of the components. Something like this:
Paul Statham
Ranch Hand
Joined: Dec 05, 2008
Posts: 38
posted
0
Rob Camick wrote:When you add the panel to a BorderLayout the size of the component is automatcally changed to take up all the space in the BorderLayout. Since a GridLayout also expands to take up all the space all the components get resized. You can prevent this by wrapping your panel into another panel that uses a layout manager that respects the preferred size of the components. Something like this: