jsplitpane

jsplitpane

View Answers

October 13, 2009 at 4:38 PM

Hi Friend,

Try the following code:

import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;

public class SplitPaneExample {
public static void main(String[] args){
JFrame frame = new SplitPaneFrame();
frame.show();
}
}
class SplitPaneFrame extends JFrame implements ListSelectionListener{
public SplitPaneFrame(){
setSize(400, 300);
list = new JList(texts);
list.addListSelectionListener(this);
description = new JTextArea();
JSplitPane innerPane= new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, list, description);
getContentPane().add(innerPane, "Center");
}
public void valueChanged(ListSelectionEvent event) { JList source = (JList)event.getSource();
Display value = (Display)source.getSelectedValue();
description.setText(value.getDescription());
}
private JList list;
private JTextArea description;
private Display[] texts =
{ new Display("Text1", "This is text1."),
new Display("Text2", "This is text2."),
new Display("Text3", "This is text3."),
new Display("Text4", "This is text4.")
};
}
class Display{
public Display(String n, String t){
name = n;
des = t;
}
public String toString(){
return name;
}
public String getDescription(){
return des;
}
private String name;
private String des;
}

Thanks









Related Tutorials/Questions & Answers:
jsplitpane - Java Beginners
jsplitpane  Hi, I need the example code for jsplitpane. I have divided into two splitpanes,while i am click the left side pane text or button ,then the corresponding text or button information will be displayed in the right
jsplitpane - Java Beginners
jsplitpane  Hi, I need the example code for jsplitpane. I have divided into two splitpanes,while i am click the left side pane text or button ,then the corresponding text or button information will be displayed in the right
Advertisements
jsplitpane - Java Beginners
(this); description = new JTextArea(); JSplitPane innerPane= new JSplitPane
jsplitpane - Java Beginners
jsplitpane  Hi, I need the example code for jsplitpane. I have divided into two splitpanes,while i am click the left side pane text or button...(); JSplitPane innerPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, list
jsplitpane - Java Beginners
jsplitpane  Hi, I need the example code for jsplitpane. I have divided into two splitpanes,while i am click the left side pane text or button...(); JSplitPane innerPane= new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, list
jsplitpane - Java Beginners
the example code for jsplitpane. I have divided into two splitpanes,while i am...(this); description = new JTextArea(); JSplitPane innerPane = new JSplitPane...(description); JPanel panel3=new JPanel(); JSplitPane innerPane = new
jsplitpane - Java Beginners
the example code for jsplitpane. I have divided into two splitpanes,while i am...(this); description = new JTextArea(); JSplitPane innerPane = new JSplitPane...(description); JPanel panel3=new JPanel(); JSplitPane innerPane = new JSplitPane
jsplitpane - Java Beginners
jsplitpane  Hi, I already post the question for three times. I need the example code for jsplitpane. I have divided into two splitpanes,while i am...(this); description = new JTextArea(); JSplitPane innerPane = new JSplitPane
java swings - Swing AWT
java swings  hi everyone, can we make a chain of frames with JSplitpane and run a shell script in any one of those frames
use of splitpane
use of splitpane  using JSplitPane split pane in three part. 1st in textField 2nd label and 3rd description. in textField we enter the primary key in textField than it show its all two part as label(image) and description of user
jList
panel = new JPanel(); panel.add(nameField); JSplitPane splitPane = new JSplitPane
Sharing a Table Model between JTable Components
, you must have to use the JSplitPane that is used to divide two components... of JSplitPane and it is also added in the frame's panel. Finally, both components... table, there will be no changes in any table. Description of code: JSplitPane
Java Swings problem - Swing AWT
Java Swings problem  Sir, I am facing a problem in JSplitPane. I want the divider in the splitpane to be customized. I have a splitpane with Horizontal orientation and here, there lies the divider between left component and right
java swings - Java Beginners
(description); final JSplitPane jSplitPane = new JSplitPane...); jSplitPane.setContinuousLayout(true); panel6.add(jSplitPane); return panel6
Listeners - Java Beginners
()); } }; jbl.addActionListener(al); JSplitPane jsp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, jbl, jbr
Tree View with database - Java Beginners
); tree.addTreeSelectionListener(this); description = new JTextArea(); JSplitPane innerPane= new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, tree, description
jlist - Java Beginners
(deleteAll); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT
SplitPane in Java Swing
Learn SplitPane in Java Swing In this section, you will learn how to create split pane using java swing. For this, we have used JSplitPane class...;   JSplitPane innerPane= new JSplitPane
Creating a Frame
a JSplitPane Container    Creating a JTabbedPane Container
Open Source XML Editor
(including JSplitPane, JScrollPane, JButton, and JTextArea). The JSplitPane
What is Java Swing?
to represent a numeric value by dragging the slider. JSplitPane

Ads