Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Class java.awt.swing.JSplitPane

java.lang.Object
    |
    +----java.awt.Component
            |
            +----java.awt.Container
                    |
                    +----java.awt.swing.JComponent
                            |
                            +----java.awt.swing.JSplitPane

public class JSplitPane
extends JComponent
implements Accessible
JSplitPane is used to divide two (and only two) Components. The two Components are graphically divided based on the look and feel implementation. By user intervention the two Components can be interactively resized.

The two Components can be aligned left to right, JSplitPane.HORIZONTAL_SPLIT, or top to bottom, JSplitPane.VERTICAL_SPLIT. The preferred way to change the size of the Componets is to invoke setDividerLocation where location is either the new x or y position depending on the orientation of the JSplitPane. JSplitPane will also try and reposition the other Component if one changes.

To resize the Components to their preferred sizes invoke resetPreferredSizes.

When the user is resizing the Components the minimum size of the Components is used to determine the maximum/minimum position the Components can be set to. So that if the minimum size of the two components is greater than the size of the splitpane the divider will not allow you to resize it. Refer to JComponent.setMinimumSize for a way to alter the minimum size of a JComponent.

Warning: serialized objects of this class will not be compatible with future swing releases. The current serialization support is appropriate for short term storage or RMI between Swing1.0 applications. It will not be possible to load serialized Swing1.0 objects with future releases of Swing. The JDK1.2 release of Swing will be the compatibility baseline for the serialized form of Swing objects.


Inner Class Summary
 JSplitPane.AccessibleJSplitPane
The class used to obtain the accessible role for this object.
 
Inner classes inherited from class java.awt.swing.JComponent
 JComponent.AccessibleJComponent
 

Field Summary
static String  BOTTOM
Used to add a Component below the other Component.
static String  CONTINUOUS_LAYOUT_PROPERTY
Bound property name for continuousLayout.
boolean  continuousLayout
Whether or not the views are continuously redisplayed while resizing.
static String  DIVIDER
Used to add a Component that will represent the divider.
static String  DIVIDER_SIZE_PROPERTY
Bound property name for border.
int  dividerSize
Size of the divider.
static int  HORIZONTAL_SPLIT
Horizontal split indicates the Components are split along the x axis, eg the two Components will be split one to the left of the other.
static String  LAST_DIVIDER_LOCATION_PROPERTY
Bound property for lastLocation.
int  lastDividerLocation
Previous location of the split pane.
static String  LEFT
Used to add a Component to go on the left side of the other Component.
Component  leftComponent
The left or top component.
static String  ONE_TOUCH_EXPANDABLE_PROPERTY
Bound property for oneTouchExpandable.
boolean  oneTouchExpandable
Is a little widget provided to quickly expand/collapse the split pane.
int  orientation
How the views are split.
static String  ORIENTATION_PROPERTY
Bound property name for orientation.
static String  RIGHT
Used to add a Component to go on the right side of the other Component.
Component  rightComponent
 
static String  TOP
Used to add a Component above the other Component.
static int  VERTICAL_SPLIT
Vertical split indicates the Components are split along the y axis, eg the two Components will be split one on top of the other.
 
Fields inherited from class java.awt.swing.JComponent
 accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
 BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 

Constructor Summary
 JSplitPane()
Returns a new JSplitPane configured to vertically divide the child components and with two buttons.
 JSplitPane(int newOrientation)
Returns a new JSplitPane configured with the passed in orientation and no continuous layout.
 JSplitPane(int newOrientation, boolean newContinuousLayout)
Returns a new JSplitPane with the specified orientation and continuousLayout.
 JSplitPane(int newOrientation, Component newLeftComponent, Component newRightComponent)
Returns a new JSplitPane with the specified orientation, continuousLayout and passed in Components.
 JSplitPane(int newOrientation, boolean newContinuousLayout, Component newLeftComponent, Component newRightComponent)
Returns a new JSplitPane with the specified orientation, continuousLayout and passed in Components.
 

Method Summary
void  addImpl(Component comp, Object constraints, int index)
If constraints identifies the left/top or right/bottom child component, and a component with that identifier was previously added, it will be removed and then comp will be added in its place.
AccessibleContext  getAccessibleContext()
Get the AccessibleContext associated with this JComponent
Component  getBottomComponent()
Returns the component below, or to the right of the divider.
int  getDividerLocation()
Returns the location of the divider from the look and feel implementation.
int  getDividerSize()
Returns the size of the divider.
int  getLastDividerLocation()
Returns the last location the divider was at.
Component  getLeftComponent()
Returns the component to the left (or above) the divider.
int  getMaximumDividerLocation()
Returns the maximum location of the divider from the look and feel implementation.
int  getMinimumDividerLocation()
Returns the minimum location of the divider from the look and feel implementation.
int  getOrientation()
Returns the orientation.
Component  getRightComponent()
Returns the component to the right (or below) the divider.
Component  getTopComponent()
Returns the component above, or to the left of the divider.
java.awt.swing.plaf.SplitPaneUI  getUI()
Returns the SplitPaneUI that is providing the current look and feel.
String  getUIClassID()
 
boolean  isContinuousLayout()
Returns true if the child comopnents are continuously redisplayed and layed out during user intervention.
boolean  isOneTouchExpandable()
Returns true if the receiver provides a UI widget to collapse/expand the divider.
void  paintChildren(Graphics g)
Subclassed to message the UI with finishedPaintingChildren after super has been messaged, as well as painting the border.
void  remove(Component component)
Removes the child component, component from the receiver.
void  remove(int index)
Removes the Component at the passed in index.
void  removeAll()
Removes all the child components from the receiver.
void  resetToPreferredSizes()
Messaged to relayout the JSplitPane based on the preferred size of the children components.
void  setBottomComponent(Component comp)
Sets the component below, or to the right of the divider.
void  setContinuousLayout(boolean newContinuousLayout)
Sets whether or not the child components are continuously redisplayed and layed out during user intervention.
void  setDividerLocation(double proportionalLocation)
Messages the receiver with setDividerLocation(proportionalLocation * size).
void  setDividerLocation(int location)
Sets the location of the divider.
void  setDividerSize(int newSize)
Sets the size of the divider to newSize.
void  setLastDividerLocation(int newLastLocation)
Sets the last location the divider was at to newLastLocation.
void  setLeftComponent(Component comp)
Sets the component to the left (or above) the divider.
void  setOneTouchExpandable(boolean newValue)
If newValue is true, the reciever will provide UI widgets on the divider to quickly expand/collapse the divider.
void  setOrientation(int orientation)
Sets the orientation, or how the splitter is divided.
void  setRightComponent(Component comp)
Sets the component to the right (or below) the divider.
void  setTopComponent(Component comp)
Sets the component above, or to the left of the divider.
void  setUI(java.awt.swing.plaf.SplitPaneUI ui)
Sets the TreeUI that will provide the current look and feel.
void  updateUI()
Called to replace the UI with the latest version from the default UIFactory.
 
Methods inherited from class java.awt.swing.JComponent
 addAncestorListener, addNotify, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setBounds, setDebugGraphicsOptions, setDoubleBuffered, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
 add, add, add, add, add, addContainerListener, addImpl, addNotify, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setLayout, update, validate, validateTree
 
Methods inherited from class java.awt.Component
 action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getColorModel, getComponentAt, getComponentAt, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERTICAL_SPLIT

public static final int VERTICAL_SPLIT
Vertical split indicates the Components are split along the y axis, eg the two Components will be split one on top of the other.

HORIZONTAL_SPLIT

public static final int HORIZONTAL_SPLIT
Horizontal split indicates the Components are split along the x axis, eg the two Components will be split one to the left of the other.

LEFT

public static final String LEFT
Used to add a Component to go on the left side of the other Component.

RIGHT

public static final String RIGHT
Used to add a Component to go on the right side of the other Component.

TOP

public static final String TOP
Used to add a Component above the other Component.

BOTTOM

public static final String BOTTOM
Used to add a Component below the other Component.

DIVIDER

public static final String DIVIDER
Used to add a Component that will represent the divider.

ORIENTATION_PROPERTY

public static final String ORIENTATION_PROPERTY
Bound property name for orientation.

CONTINUOUS_LAYOUT_PROPERTY

public static final String CONTINUOUS_LAYOUT_PROPERTY
Bound property name for continuousLayout.

DIVIDER_SIZE_PROPERTY

public static final String DIVIDER_SIZE_PROPERTY
Bound property name for border.

ONE_TOUCH_EXPANDABLE_PROPERTY

public static final String ONE_TOUCH_EXPANDABLE_PROPERTY
Bound property for oneTouchExpandable.

LAST_DIVIDER_LOCATION_PROPERTY

public static final String LAST_DIVIDER_LOCATION_PROPERTY
Bound property for lastLocation.

orientation

protected int orientation
How the views are split.

continuousLayout

protected boolean continuousLayout
Whether or not the views are continuously redisplayed while resizing.

leftComponent

protected Component leftComponent
The left or top component.

rightComponent

protected Component rightComponent

dividerSize

protected int dividerSize
Size of the divider.

oneTouchExpandable

protected boolean oneTouchExpandable
Is a little widget provided to quickly expand/collapse the split pane.

lastDividerLocation

protected int lastDividerLocation
Previous location of the split pane.
Constructor Detail

JSplitPane

public JSplitPane()
Returns a new JSplitPane configured to vertically divide the child components and with two buttons.

JSplitPane

public JSplitPane(int newOrientation)
Returns a new JSplitPane configured with the passed in orientation and no continuous layout.

JSplitPane

public JSplitPane(int newOrientation,
                  boolean newContinuousLayout)
Returns a new JSplitPane with the specified orientation and continuousLayout.

JSplitPane

public JSplitPane(int newOrientation,
                  Component newLeftComponent,
                  Component newRightComponent)
Returns a new JSplitPane with the specified orientation, continuousLayout and passed in Components.

JSplitPane

public JSplitPane(int newOrientation,
                  boolean newContinuousLayout,
                  Component newLeftComponent,
                  Component newRightComponent)
Returns a new JSplitPane with the specified orientation, continuousLayout and passed in Components.
Method Detail

setUI

public void setUI(java.awt.swing.plaf.SplitPaneUI ui)
Sets the TreeUI that will provide the current look and feel.

getUI

public java.awt.swing.plaf.SplitPaneUI getUI()
Returns the SplitPaneUI that is providing the current look and feel.

updateUI

public void updateUI()
Called to replace the UI with the latest version from the default UIFactory.
Overrides:
updateUI in class JComponent

getUIClassID

public String getUIClassID()
Returns:
"SplitPaneUI"
Overrides:
getUIClassID in class JComponent
See Also:
getUIClassID, getUI

setDividerSize

public void setDividerSize(int newSize)
Sets the size of the divider to newSize.

getDividerSize

public int getDividerSize()
Returns the size of the divider.

setLeftComponent

public void setLeftComponent(Component comp)
Sets the component to the left (or above) the divider.

getLeftComponent

public Component getLeftComponent()
Returns the component to the left (or above) the divider.

setTopComponent

public void setTopComponent(Component comp)
Sets the component above, or to the left of the divider.

getTopComponent

public Component getTopComponent()
Returns the component above, or to the left of the divider.

setRightComponent

public void setRightComponent(Component comp)
Sets the component to the right (or below) the divider.

getRightComponent

public Component getRightComponent()
Returns the component to the right (or below) the divider.

setBottomComponent

public void setBottomComponent(Component comp)
Sets the component below, or to the right of the divider.

getBottomComponent

public Component getBottomComponent()
Returns the component below, or to the right of the divider.

setOneTouchExpandable

public void setOneTouchExpandable(boolean newValue)
If newValue is true, the reciever will provide UI widgets on the divider to quickly expand/collapse the divider.

isOneTouchExpandable

public boolean isOneTouchExpandable()
Returns true if the receiver provides a UI widget to collapse/expand the divider.

setLastDividerLocation

public void setLastDividerLocation(int newLastLocation)
Sets the last location the divider was at to newLastLocation.

getLastDividerLocation

public int getLastDividerLocation()
Returns the last location the divider was at.

setOrientation

public void setOrientation(int orientation)
Sets the orientation, or how the splitter is divided.

getOrientation

public int getOrientation()
Returns the orientation.

setContinuousLayout

public void setContinuousLayout(boolean newContinuousLayout)
Sets whether or not the child components are continuously redisplayed and layed out during user intervention.

isContinuousLayout

public boolean isContinuousLayout()
Returns true if the child comopnents are continuously redisplayed and layed out during user intervention.

resetToPreferredSizes

public void resetToPreferredSizes()
Messaged to relayout the JSplitPane based on the preferred size of the children components.

setDividerLocation

public void setDividerLocation(double proportionalLocation)
Messages the receiver with setDividerLocation(proportionalLocation * size). Where size is either getWidth() or getHeight(). This will throw an IllegalArgumentException if proportionalLocation is < 0 or > 1.0.

setDividerLocation

public void setDividerLocation(int location)
Sets the location of the divider. This is passed off to the look and feel implementation.

getDividerLocation

public int getDividerLocation()
Returns the location of the divider from the look and feel implementation.

getMinimumDividerLocation

public int getMinimumDividerLocation()
Returns the minimum location of the divider from the look and feel implementation.

getMaximumDividerLocation

public int getMaximumDividerLocation()
Returns the maximum location of the divider from the look and feel implementation.

remove

public void remove(Component component)
Removes the child component, component from the receiver. Reset the leftComponent or rightComponent instance variable if necessary.
Overrides:
remove in class Container

remove

public void remove(int index)
Removes the Component at the passed in index. This updates the leftComponent and rightComponent ivars if necessary, and then messages super.
Overrides:
remove in class Container

removeAll

public void removeAll()
Removes all the child components from the receiver. Resets the leftComonent and rightComponent instance variables.
Overrides:
removeAll in class Container

addImpl

protected void addImpl(Component comp,
                       Object constraints,
                       int index)
If constraints identifies the left/top or right/bottom child component, and a component with that identifier was previously added, it will be removed and then comp will be added in its place. If constraints is not one of the known identifers the layout manager may throw an IllegalArgumentException.
Overrides:
addImpl in class Container

paintChildren

protected void paintChildren(Graphics g)
Subclassed to message the UI with finishedPaintingChildren after super has been messaged, as well as painting the border.
Overrides:
paintChildren in class JComponent

getAccessibleContext

public AccessibleContext getAccessibleContext()
Get the AccessibleContext associated with this JComponent
Implements:
getAccessibleContext in interface Accessible
Returns:
the AccessibleContext of this JComponent
Overrides:
getAccessibleContext in class JComponent

Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Submit a bug or feature
Submit comments/suggestions about new javadoc look.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.