Distributing Space When a JSplitPane Container Is Resized
import javax.swing.JButton;
import javax.swing.JSplitPane;
public class Main {
public static void main(String[] argv) throws Exception {
JButton leftComponent = new JButton("left");
JButton rightComponent = new JButton("right");
JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftComponent, rightComponent);
double weight = pane.getResizeWeight(); // 0.0 by default
weight = 1D;
pane.setResizeWeight(weight);
weight = .5D;
pane.setResizeWeight(weight);
}
}
Related examples in the same category