The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > javax.swing  [141 examples] > JSplitPane  [5 examples]

e824. Getting the Setting the Children in a JSplitPane Container

    // Create a left-right split pane
    JSplitPane hpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftComponent, rightComponent);
    
    // Create a top-bottom split pane
    JSplitPane vpane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topComponent, bottomComponent);
    
    
    // Get the children from the horizontal split pane
    leftComponent = hpane.getLeftComponent();
    rightComponent = hpane.getRightComponent();
    
    // Get the children from the vertical split pane
    topComponent = vpane.getTopComponent();
    bottomComponent = vpane.getBottomComponent();
    
    // Replace the children in the horizontal split pane
    hpane.setLeftComponent(comp1);
    hpane.setRightComponent(comp2);
    
    // Replace the children in the vertical split pane
    vpane.setTopComponent(comp3);
    vpane.setBottomComponent(comp4);

 Related Examples
e823. Creating a JSplitPane Container
e825. Distributing Space When a JSplitPane Container Is Resized
e826. Getting and Setting the Divider Location in a JSplitPane Container
e827. Setting the Size of the Divider in a JSplitPane Container

See also: Actions    JButton    JCheckBox    JComboBox    JDesktop and JInternalFrame    JFrame, JWindow, JDialog    JLabel    JList    JProgressBar    JRadioButton    JScrollPane    JSlider    JSpinner    JTabbedPane    JToolBar    Keystrokes and Input Maps    Layout    Look and Feel    Menus    Progress Monitor    The Screen    Tool Tips    UI Default Values   


© 2002 Addison-Wesley.