Java Platform 1.2

javax.swing.plaf.basic
Class BasicSplitPaneDivider

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.plaf.basic.BasicSplitPaneDivider

public class BasicSplitPaneDivider
extends Container
implements PropertyChangeListener

Divider used by BasicSplitPaneUI. Subclassers may wish to override paint to do something more interesting. The border effect is drawn in BasicSplitPaneUI, so if you don't like that border, reset it there. To conditionally drag from certain areas subclass mousePressed and call super when you wish the dragging to begin.

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 applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

See Also:
Serialized Form

Inner Class Summary
protected  class BasicSplitPaneDivider.DividerLayout
          Used to layout a BasicSplitPaneDivider.
protected  class BasicSplitPaneDivider.DragController
          Handles the events during a dragging session for a HORIZONTAL_SPLIT orientated split pane.
protected  class BasicSplitPaneDivider.MouseHandler
          MouseHandler is responsible for converting mouse events (released, dragged...) into the appropriate DragController methods.
protected  class BasicSplitPaneDivider.VerticalDragController
          Handles the events during a dragging session for a VERTICAL_SPLIT orientated split pane.
 
Field Summary
protected  int dividerSize
          Size of the divider.
protected  BasicSplitPaneDivider.DragController dragger
          Handles mouse dragging message to do the actual dragging.
protected  Component hiddenDivider
          Divider that is used for noncontinuous layout mode.
protected  JButton leftButton
          Button for quickly toggling the left component.
protected  BasicSplitPaneDivider.MouseHandler mouseHandler
          Handle of mouse events.
protected static int ONE_TOUCH_OFFSET
           
protected static int ONE_TOUCH_SIZE
          Width or height of the divider based on orientation BasicSplitPaneUI adds two to this.
protected  int orientation
          Orientation of the JSplitPane.
protected  JButton rightButton
          Button for quickly toggling the right component.
protected  JSplitPane splitPane
          JSplitPane the receiver is contained in.
protected  BasicSplitPaneUI splitPaneUI
          UI this instance was created from.
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
BasicSplitPaneDivider(BasicSplitPaneUI ui)
          Creates an instance of BasicSplitPaneDivider.
 
Method Summary
protected  JButton createLeftOneTouchButton()
          Creates and return an instance of JButton that can be used to collapse the left component in the split pane.
protected  JButton createRightOneTouchButton()
          Creates and return an instance of JButton that can be used to collapse the right component in the split pane.
protected  void dragDividerTo(int location)
          Messages the BasicSplitPaneUI with dragDividerTo that this instance is contained in.
protected  void finishDraggingTo(int location)
          Messages the BasicSplitPaneUI with finishDraggingTo that this instance is contained in.
 BasicSplitPaneUI getBasicSplitPaneUI()
          Returns the SplitPaneUI the receiver is currently in.
 int getDividerSize()
          Returns the size of the divider, that is the width if the splitpane is HORIZONTAL_SPLIT, or the height of VERTICAL_SPLIT.
 Dimension getPreferredSize()
          Returns dividerSize x dividerSize
protected  void oneTouchExpandableChanged()
          Messaged when the oneTouchExpandable value of the JSplitPane the receiver is contained in changes.
 void paint(Graphics g)
          Paints the divider.
protected  void prepareForDragging()
          Message to prepare for dragging.
 void propertyChange(PropertyChangeEvent e)
          Property change event, presumably from the JSplitPane, will message updateOrientation if necessary.
 void setBasicSplitPaneUI(BasicSplitPaneUI newUI)
          Sets the SplitPaneUI that is using the receiver.
 void setDividerSize(int newSize)
          Sets the size of the divider to newSize.
 
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, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ONE_TOUCH_SIZE

protected static final int ONE_TOUCH_SIZE
Width or height of the divider based on orientation BasicSplitPaneUI adds two to this.

ONE_TOUCH_OFFSET

protected static final int ONE_TOUCH_OFFSET

dragger

protected BasicSplitPaneDivider.DragController dragger
Handles mouse dragging message to do the actual dragging.

splitPaneUI

protected BasicSplitPaneUI splitPaneUI
UI this instance was created from.

dividerSize

protected int dividerSize
Size of the divider.

hiddenDivider

protected Component hiddenDivider
Divider that is used for noncontinuous layout mode.

splitPane

protected JSplitPane splitPane
JSplitPane the receiver is contained in.

mouseHandler

protected BasicSplitPaneDivider.MouseHandler mouseHandler
Handle of mouse events.

orientation

protected int orientation
Orientation of the JSplitPane.

leftButton

protected JButton leftButton
Button for quickly toggling the left component.

rightButton

protected JButton rightButton
Button for quickly toggling the right component.
Constructor Detail

BasicSplitPaneDivider

public BasicSplitPaneDivider(BasicSplitPaneUI ui)
Creates an instance of BasicSplitPaneDivider. Registers this instance for mouse events and mouse dragged events.
Method Detail

setBasicSplitPaneUI

public void setBasicSplitPaneUI(BasicSplitPaneUI newUI)
Sets the SplitPaneUI that is using the receiver.

getBasicSplitPaneUI

public BasicSplitPaneUI getBasicSplitPaneUI()
Returns the SplitPaneUI the receiver is currently in.

setDividerSize

public void setDividerSize(int newSize)
Sets the size of the divider to newSize. That is the width if the splitpane is HORIZONTAL_SPLIT, or the height of VERTICAL_SPLIT.

getDividerSize

public int getDividerSize()
Returns the size of the divider, that is the width if the splitpane is HORIZONTAL_SPLIT, or the height of VERTICAL_SPLIT.

getPreferredSize

public Dimension getPreferredSize()
Returns dividerSize x dividerSize
Overrides:
getPreferredSize in class Container

propertyChange

public void propertyChange(PropertyChangeEvent e)
Property change event, presumably from the JSplitPane, will message updateOrientation if necessary.
Specified by:
propertyChange in interface PropertyChangeListener

paint

public void paint(Graphics g)
Paints the divider.
Overrides:
paint in class Container

oneTouchExpandableChanged

protected void oneTouchExpandableChanged()
Messaged when the oneTouchExpandable value of the JSplitPane the receiver is contained in changes. Will create the leftButton and rightButton if they are null. invalidates the receiver as well.

createLeftOneTouchButton

protected JButton createLeftOneTouchButton()
Creates and return an instance of JButton that can be used to collapse the left component in the split pane.

createRightOneTouchButton

protected JButton createRightOneTouchButton()
Creates and return an instance of JButton that can be used to collapse the right component in the split pane.

prepareForDragging

protected void prepareForDragging()
Message to prepare for dragging. This messages the BasicSplitPaneUI with startDragging.

dragDividerTo

protected void dragDividerTo(int location)
Messages the BasicSplitPaneUI with dragDividerTo that this instance is contained in.

finishDraggingTo

protected void finishDraggingTo(int location)
Messages the BasicSplitPaneUI with finishDraggingTo that this instance is contained in.

Java Platform 1.2

Submit a bug or feature Version 1.2 of Java Platform API Specification
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.