SplitPane Test : Splitpane « Swing JFC « Java

Java
1. 2D Graphics GUI
2. 3D
3. Advanced Graphics
4. Ant
5. Apache Common
6. Chart
7. Class
8. Collections Data Structure
9. Data Type
10. Database SQL JDBC
11. Design Pattern
12. Development Class
13. EJB3
14. Email
15. Event
16. File Input Output
17. Game
18. Generics
19. GWT
20. Hibernate
21. I18N
22. J2EE
23. J2ME
24. JDK 6
25. JNDI LDAP
26. JPA
27. JSP
28. JSTL
29. Language Basics
30. Network Protocol
31. PDF RTF
32. Reflection
33. Regular Expressions
34. Scripting
35. Security
36. Servlets
37. Spring
38. Swing Components
39. Swing JFC
40. SWT JFace Eclipse
41. Threads
42. Tiny Application
43. Velocity
44. Web Services SOA
45. XML
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java » Swing JFC » SplitpaneScreenshots 
SplitPane Test
SplitPane Test
 
/**
 @version 1.00 1999-07-17
 @author Cay Horstmann
 */

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

public class SwingSplitPaneTest {  
   public static void main(String[] args)
   {  JFrame frame = new SplitPaneFrame();
      frame.show();
   }
}

class SplitPaneFrame extends JFrame
   implements ListSelectionListener
{  public SplitPaneFrame()
   {  setTitle("SplitPaneTest");
      setSize(400300);
      addWindowListener(new WindowAdapter()
         {  public void windowClosing(WindowEvent e)
            {  System.exit(0);
            }
         } );

      // set up components for planet names, images, descriptions

      planetList = new JList(planets);
      planetList.addListSelectionListener(this);

      planetImage = new JLabel();

      description = new JTextArea();

      // set up split panes

      JSplitPane innerPane
         new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
            planetList, planetImage);

      innerPane.setContinuousLayout(true);
      innerPane.setOneTouchExpandable(true);

      JSplitPane outerPane
         new JSplitPane(JSplitPane.VERTICAL_SPLIT,
            innerPane, description);

      getContentPane().add(outerPane, "Center");
   }

   public void valueChanged(ListSelectionEvent event)
   {  JList source = (JList)event.getSource();
      Planet value = (Planet)source.getSelectedValue();

      // update image and description

      planetImage.setIcon(value.getImage());
      description.setText(value.getDescription());
   }

   private JList planetList;
   private JLabel planetImage;
   private JTextArea description;
   private Planet[] planets =
      {  new Planet("Mercury"24400),
         new Planet("Venus"60520),
         new Planet("Earth"63781),
         new Planet("Mars"33972),
         new Planet("Jupiter"7149216),
         new Planet("Saturn"6026818),
         new Planet("Uranus"2555917),
         new Planet("Neptune"247668),
         new Planet("Pluto"11371),
      };
}

class Planet
{  public Planet(String n, double r, int m)
   {  name = n;
      radius = r;
      moons = m;
      image = new ImageIcon(name + ".gif");
   }

   public String toString()
   {  return name;
   }

   public String getDescription()
   {  return "Radius: " + radius + "\nMoons: " + moons + "\n";
   }

   public ImageIcon getImage()
   {  return image;
   }

   private String name;
   private double radius;
   private int moons;
   private ImageIcon image;
}


           
         
  
Related examples in the same category
1. Create a left-right split pane
2. Create a top-bottom split pane
3. A quick test of the JSplitPane classA quick test of the JSplitPane class
4. SplitPane Demo 2
5. Swing SplitPane SampleSwing SplitPane Sample
6. Resize SplitPaneResize SplitPane
7. SplitPane: VerticalSplitSplitPane: VerticalSplit
8. SplitPane Sample 3SplitPane Sample 3
9. Property SplitProperty Split
10. Use the split paneUse the split pane
11. Continuously move the divider and resize its child components while the user is dragging the divider
12. Getting the Setting the Children in a JSplitPane Container
13. Getting and Setting the Divider Location in a JSplitPane Container
14. Distributing Space When a JSplitPane Container Is Resized
15. The split pane supports a one-touch-expandable capability that allows the user to conveniently move the divider to either end with a single click
ww__w._j___a___v___a__2___s___.__c___om___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.