Jake
Jake

Reputation: 313

Changing size of a panel

Soo I'm trying to make two panels and I wanted the top panel to be at least 2/3 of the window. I used GridLayout and it splits it in half, and I want to make it soo that the top is a little bit bigger. Is there another Layout I should consider instead of GridLayout?

Upvotes: 0

Views: 25

Answers (1)

Jean Jung
Jean Jung

Reputation: 1210

You can use a javax.swing.JSplitPane like:

JSplitPane spt = new JSplitPane();
spt.setDividerSize(12);
spt.setOrientation(JSplitPane.VERTICAL_SPLIT);
spt.setRightComponent(imagePanel1);
spt.setLeftComponent(imagePanel2);
spt.setDividerLocation(0.8);

And adjust the values for your necessity.

Upvotes: 2

Related Questions