Share on Google+Share on Google+

valarmathi
jsplitpane
1 Answer(s)      7 years ago
Posted in : Java Beginners

Ads

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
to use the JSplitPane that is used to divide two components. These components... the HORIZONTAL_SPLIT. Both components are added in the object of JSplitPane..., there will be no changes in any table. Description of code: JSplitPane
java swings - Java Beginners
(description); final JSplitPane jSplitPane = new JSplitPane...); jSplitPane.setContinuousLayout(true); panel6.add(jSplitPane); return panel6
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
jlist - Java Beginners
(deleteAll); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT
Tree View with database - Java Beginners
); tree.addTreeSelectionListener(this); description = new JTextArea(); JSplitPane innerPane= new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, tree, description
Listeners - Java Beginners
()); } }; jbl.addActionListener(al); JSplitPane jsp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, jbl, jbr
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?
value by dragging the slider. JSplitPane This class used
Tutorials   
Java Spring Hibernate Struts Training What does core Java include? java What are some way to learn Java quickly? Is it required to learn Java before learning Java Script? Is it necessary to learn java script before learning PHP? Are HTML5 and Java Script boosts Java career? Is Java object oriented? Fingerprint application with Java Uninstall Oracle Virtual Box JSON to HashMap Free Java online Training I want example of Control Statement in Java ANSI Color Codes with Python Create a Program that Calculates Input What is difference between JDK,JRE and JVM? How to see ubuntu version on server? How to get Page Source in Selenium (WebDriver) using Java? The path to the driver executable must be set by the webdriver.gecko.driver system property parse data from a link in java Java Program Qns using BlueJ How to fix HAX Kernel Module Is Not Installed error? Installing Audacity Looking for code Logic to check track changes & Coments in MSWord, MSWordx, MSExcel, MSExcelx is ON/OFF Installing JDK on Mac SAX Parser exception ERROR 601 (42P00): Syntax error. Encountered Thread java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory How to install Ubuntu 16.04 LTS? HttpServletRequest cannot be resolved to a type in eclipse - Solved Unhandled event loop exception GC overhead limit exceeded Spring Data jpa with apache phoenix Caused by: java.lang.IllegalArgumentException: Not a host:port pair: PBUF o.a.h.h.z.RecoverableZooKeeper - Possibly transient ZooKeeper, quorum= com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager class not found com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager not found How to download and install Java 8 on Windows? How to uninstall JDK 7? How to install gtk-doc-tools package in Ubuntu? How to install Oracle JDK 8 on Ubuntu? ejabberd_ctl.beam not found - Solved How to convert date to UTC format in Java? How to install autoconf, automake and libtool in Ubuntu 15.10? How to convert current date to mm dd yyyy format in Java? How to convert current date to dd mm yyyy format in Java? How to stop window closing in "internalFrameClosing" event. How to find list of all index in Neo4j? neo4j-server.properties file location SASLError using PLAIN: not-authorized how to convert war file into .exe file using java code

Ads

 
Advertisement null

Ads