Monday, October 22, 2012

006. CONTAINER: JSPLITPANE BY NETBEANS


You can use JSplitpane to put two components, either left by right, or top by bottom. The user can resize a component by moving the divider. As usually, we asume that we have read and understood 001. THE BEGINNING.
  1. Create a JFrame then named Splitpane.
  2. Put JSplitpane from Palette
  3. Set properties, orientation=VERTICAL_SPLIT, dividerLocation=150
     
  4. Put another JSplitpane from Palette on top component.
  5. On Inspector, right-click jSplitPane2 (new JSplitpane) then renamed "splTop".
  6. Put another JSplitpane from Palette on bottom component.
  7. On Inspector, right-click the new JSplitpane then renamed "splBottom".
  8. On Inspector, click splTop, change property dividerLocation=150


  9. Run program

HOLDING THE BOTTOM-SIZE WHEN RESIZING THE JFRAME
  1. On Inspector, click the jSplitpane1 that we want to hold the bottom-size

  2. Setting the property, resizeWeight=1.0
  3. On Inspector, click splBottom
  4. Setting the properties,  maximumSize=0, minimumSize=0, and preferredSize=0

HOLDING THE RIGHT-SIZE WHEN RESIZING THE JFRAME
  1. From Palette click JPanel and put in on the right of splTop.
  2. On Inspector, click splTop, then set property, resizeWeight=1.0
     

  3. On Inspector, click jPanel1
  4. Setting the jPanel1's properties,  maximumSize=0, minimumSize=0, and preferredSize=0
  5. Just for tag, from Palette click JTabbedPane, and put it on the right of splBottom.
  6. From Palette, click JPanel and put it on JTabbedPane.
  7. From Palette, click JButton and put it on the new JPanel.
Please, run it.