Results 1 to 6 of 6

Thread: JSplitPane class of java

  1. #1
    Join Date
    Dec 2009
    Posts
    32

    JSplitPane class of java

    Hello friend,

    I am beginner to the advanced java programming. I need you help to know about the JSplitPane class of java. This class of java seems very complicated to understand. I don't have any idea about it's constructors and methods. If you have sound knowledge regarding JSplitPane class of java, then please let me know the same. Suitable example over JSplitPane class will be greatly appreciated.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: JSplitPane class of java

    Hi,

    SplitPane is used to divide two (and only two) Components. The two Components are graphically divided based on the look and feel implementation, and the two Components can then be interactively resized by the user. The two Components in a split pane can be aligned left to right using JSplitPane.HORIZONTAL_SPLIT, or top to bottom using JSplitPane.VERTICAL_SPLIT. The preferred way to change the size of the Components is to invoke setDividerLocation where location is either the new x or y position, depending on the orientation of the JSplitPane.

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: JSplitPane class of java

    Please refer following example of JSplitPane class of java:
    Code:
    import javax.swing.JSplitPane;
    
    public class JSplitPaneDemo{
      
      public static void main(String[] a) {
       int HORIZSPLT = JSplitPane.HORIZONTAL_SPLIT;
        int VERTSPLT = JSplitPane.VERTICAL_SPLIT;
    
        boolean continuousLayout = true;
        JLabel labelv1 = new JLabel("a");
        JLabel labelv2 = new JLabel("b");
        JLabel labelv3 = new JLabel("c");
        JSplitPane splitPane01 = new JSplitPane(VERTSPLIT, continuousLayout, label1, label2);
        splitPane01.setOneTouchExpandable(true);
        splitPane01.setDividerSize(2);
        splitPane01.setDividerLocation(0.5);
    
        JSplitPane splitPane2 = new JSplitPane(HORIZSPLIT, splitPane01, label3);
        splitPane2.setOneTouchExpandable(true);
        splitPane2.setDividerLocation(0.4);
        splitPane2.setDividerSize(2);
    
        JFrame frame07 = new JFrame();
        frame07.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame07.add(splitPane2);
        frame07.pack();
        frame07.setVisible(true);
      }
    }

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: JSplitPane class of java

    Hello friend,

    Following are some constructors of JSplitPane class along with different parameters:
    • JSplitPane(int newOrn, Component newLeftComp, Component newRightComp)
    • JSplitPane(int newOrn, boolean newContinuousLyt, Component newLeftComp, Component newRightComp)
    • JSplitPane(int newOrn, boolean newContinuousLyt)
    • JSplitPane(int newOrn)
    • JSplitPane()

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Re: JSplitPane class of java

    Following part of java program will demonstrate you the use of JSplitPane class of java, please review it carefully:
    Code:
    public JSplitPane()
    JSplitPane splitPn = new JSplitPane();
    public JSplitPane(int Orn)
    JSplitPane splitPn = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    
    public JSplitPane(int Orn, Component newLeftComponent, Component newRightComponent)
    JComponent topComponent = new JButton("Top Button");
    JComponent bottomComponent = new JButton("Bottom Button");
    JSplitPane splitPn = new JSplitPane(JSplitPane.VERTICAL_SPLIT, topComponent, bottomComponent);
    
    public JSplitPane(int Orn, boolean newContinuousLayout)
    JSplitPane splitPn = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true);
    
    public JSplitPane(int Orn, boolean newContinuousLayout, Component newLeftComponent, Component newRightComponent)
    JSplitPane splitPn = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, topComponent, bottomComponent);

  6. #6
    Join Date
    Oct 2005
    Posts
    2,393

    Re: JSplitPane class of java

    Hi friend,

    To make use use of JSplitPane class, you need to be aware about following important methods of this class:
    1. setUI(SplitPaneUI sui)
    2. setTopComponent(Component compn)
    3. setRightComponent(Component compn)
    4. setResizeWeight(double val)
    5. setOrientation(int ortn)
    6. setOneTouchExpandable(boolean newVal)

Similar Threads

  1. Converting java class to java bean class
    By Ucchal in forum Software Development
    Replies: 6
    Last Post: 09-08-2010, 10:24 AM
  2. ImageIcon class of java
    By Modifier in forum Software Development
    Replies: 5
    Last Post: 19-02-2010, 09:53 AM
  3. Use of JWindow class in java
    By Ram Bharose in forum Software Development
    Replies: 5
    Last Post: 12-02-2010, 11:11 AM
  4. Canvas inside JSplitPane
    By MAHAH in forum Software Development
    Replies: 4
    Last Post: 04-11-2009, 11:53 PM
  5. Java Programming Language Basics: Reflection Basics and Class Class
    By mayuri_gunjan in forum Guides & Tutorials
    Replies: 6
    Last Post: 29-08-2005, 12:04 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,707,301.25087 seconds with 17 queries