// using JSplitPane JSplitPane splitPane; JPanel panel1; JPanel panel2; // ... // Put the two panels side by side, with panel1 on the left. // The dividing line is a vertical bar. splitPane = new JSplitPane( JSplitPane.HORIZONTAL_SPLIT, panel1, panel2 ); // provide a widget on the divider to rapidily expand it. splitPane.setOneTouchExpandable( true ); // set initial position of divider splitPane.setDividerLocation( 150 ); // Provide minimum sizes for the two components in the split pane // We don't have a formal LayoutManager. // There is no need for setPreferredSize or SetMaximumSize. Dimension minimumSize = new Dimension( 100, 50 ); panel1.setMinimumSize( minimumSize ); panel2.setMinimumSize( minimumSize );