JSplitPane: setResizeWeight(double value)
import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JSplitPane;
public class MainClass {
public static void main(String args[]) throws Exception {
JFrame frame = new JFrame("Property Split");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
splitPane.setResizeWeight(1.0);
splitPane.setTopComponent(new JLabel("www.java2s.com"));
splitPane.setBottomComponent(new JLabel("www.java2s.com"));
frame.add(splitPane, BorderLayout.CENTER);
frame.setSize(300, 150);
frame.setVisible(true);
}
}
Related examples in the same category