Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , , , , , ,

Sponsored Links


JSplitPane class of java

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 15-02-2010
Member
 
Join Date: Dec 2009
Posts: 32
JSplitPane class of java

Sponsored Links
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.

Reply With Quote
  #2  
Old 15-02-2010
Praetor's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,943
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.
Reply With Quote
  #3  
Old 15-02-2010
Member
 
Join Date: May 2008
Posts: 2,000
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);
  }
}
Reply With Quote
  #4  
Old 15-02-2010
kelfro's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,989
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()
Reply With Quote
  #5  
Old 15-02-2010
Zecho's Avatar
Member
 
Join Date: May 2008
Posts: 2,278
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);
Reply With Quote
  #6  
Old 15-02-2010
Reegan's Avatar
Member
 
Join Date: Oct 2005
Posts: 2,381
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)
Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "JSplitPane class of java"
Thread Thread Starter Forum Replies Last Post
Converting java class to java bean class Ucchal Software Development 6 09-08-2010 10:24 AM
JDesktopPane class of java Sonam Goenka Software Development 5 18-02-2010 07:14 AM
Use of JWindow class in java Ram Bharose Software Development 5 12-02-2010 10:11 AM
Canvas inside JSplitPane MAHAH Software Development 4 04-11-2009 10:53 PM
Java Programming Language Basics: Reflection Basics and Class Class mayuri_gunjan Guides & Tutorials 6 29-08-2005 12:04 AM


All times are GMT +5.5. The time now is 07:12 PM.