BasicSplitPaneDivider (Java 2 Platform SE 5.0) (original) (raw)
javax.swing.plaf.basic
Class BasicSplitPaneDivider
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.plaf.basic.BasicSplitPaneDivider
All Implemented Interfaces:
ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener
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. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans
package. Please see XMLEncoder.
Nested 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 oriented 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 oriented split pane. |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
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 Handles mouse events from both this class, and the split pane. |
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 |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
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. |
Border | getBorder() Returns the border of this component or null if no border is currently set. |
int | getDividerSize() Returns the size of the divider, that is the width if the splitpane is HORIZONTAL_SPLIT, or the height of VERTICAL_SPLIT. |
Insets | getInsets() If a border has been set on this component, returns the border's insets, else calls super.getInsets. |
Dimension | getMinimumSize() Returns dividerSize x dividerSize |
Dimension | getPreferredSize() Returns dividerSize x dividerSize |
boolean | isMouseOver() Returns whether or not the mouse is currently over the divider |
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 | setBorder(Border border) Sets the border of this component. |
void | setDividerSize(int newSize) Sets the size of the divider to newSize. |
protected void | setMouseOver(boolean mouseOver) Sets whether or not the mouse is currently over the divider. |
Methods inherited from class java.awt.Container |
---|
add, [add](../../../../java/awt/Container.html#add%28java.awt.Component, int%29), [add](../../../../java/awt/Container.html#add%28java.awt.Component, java.lang.Object%29), [add](../../../../java/awt/Container.html#add%28java.awt.Component, java.lang.Object, int%29), [add](../../../../java/awt/Container.html#add%28java.lang.String, java.awt.Component%29), addContainerListener, [addImpl](../../../../java/awt/Container.html#addImpl%28java.awt.Component, java.lang.Object, int%29), addNotify, addPropertyChangeListener, [addPropertyChangeListener](../../../../java/awt/Container.html#addPropertyChangeListener%28java.lang.String, java.beans.PropertyChangeListener%29), applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, [findComponentAt](../../../../java/awt/Container.html#findComponentAt%28int, int%29), findComponentAt, getAlignmentX, getAlignmentY, getComponent, [getComponentAt](../../../../java/awt/Container.html#getComponentAt%28int, int%29), getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getListeners, getMaximumSize, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, [list](../../../../java/awt/Container.html#list%28java.io.PrintStream, int%29), [list](../../../../java/awt/Container.html#list%28java.io.PrintWriter, int%29), [locate](../../../../java/awt/Container.html#locate%28int, int%29), minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, [setComponentZOrder](../../../../java/awt/Container.html#setComponentZOrder%28java.awt.Component, int%29), setFocusCycleRoot, [setFocusTraversalKeys](../../../../java/awt/Container.html#setFocusTraversalKeys%28int, java.util.Set%29), setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
[action](../../../../java/awt/Component.html#action%28java.awt.Event, java.lang.Object%29), add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, [checkImage](../../../../java/awt/Component.html#checkImage%28java.awt.Image, java.awt.image.ImageObserver%29), [checkImage](../../../../java/awt/Component.html#checkImage%28java.awt.Image, int, int, java.awt.image.ImageObserver%29), [coalesceEvents](../../../../java/awt/Component.html#coalesceEvents%28java.awt.AWTEvent, java.awt.AWTEvent%29), [contains](../../../../java/awt/Component.html#contains%28int, int%29), contains, createImage, [createImage](../../../../java/awt/Component.html#createImage%28int, int%29), [createVolatileImage](../../../../java/awt/Component.html#createVolatileImage%28int, int%29), [createVolatileImage](../../../../java/awt/Component.html#createVolatileImage%28int, int, java.awt.ImageCapabilities%29), disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, [firePropertyChange](../../../../java/awt/Component.html#firePropertyChange%28java.lang.String, boolean, boolean%29), [firePropertyChange](../../../../java/awt/Component.html#firePropertyChange%28java.lang.String, byte, byte%29), [firePropertyChange](../../../../java/awt/Component.html#firePropertyChange%28java.lang.String, char, char%29), [firePropertyChange](../../../../java/awt/Component.html#firePropertyChange%28java.lang.String, double, double%29), [firePropertyChange](../../../../java/awt/Component.html#firePropertyChange%28java.lang.String, float, float%29), [firePropertyChange](../../../../java/awt/Component.html#firePropertyChange%28java.lang.String, int, int%29), [firePropertyChange](../../../../java/awt/Component.html#firePropertyChange%28java.lang.String, long, long%29), [firePropertyChange](../../../../java/awt/Component.html#firePropertyChange%28java.lang.String, java.lang.Object, java.lang.Object%29), [firePropertyChange](../../../../java/awt/Component.html#firePropertyChange%28java.lang.String, short, short%29), getAccessibleContext, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, [gotFocus](../../../../java/awt/Component.html#gotFocus%28java.awt.Event, java.lang.Object%29), handleEvent, hasFocus, hide, [imageUpdate](../../../../java/awt/Component.html#imageUpdate%28java.awt.Image, int, int, int, int, int%29), [inside](../../../../java/awt/Component.html#inside%28int, int%29), isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, [keyDown](../../../../java/awt/Component.html#keyDown%28java.awt.Event, int%29), [keyUp](../../../../java/awt/Component.html#keyUp%28java.awt.Event, int%29), list, list, list, location, [lostFocus](../../../../java/awt/Component.html#lostFocus%28java.awt.Event, java.lang.Object%29), [mouseDown](../../../../java/awt/Component.html#mouseDown%28java.awt.Event, int, int%29), [mouseDrag](../../../../java/awt/Component.html#mouseDrag%28java.awt.Event, int, int%29), [mouseEnter](../../../../java/awt/Component.html#mouseEnter%28java.awt.Event, int, int%29), [mouseExit](../../../../java/awt/Component.html#mouseExit%28java.awt.Event, int, int%29), [mouseMove](../../../../java/awt/Component.html#mouseMove%28java.awt.Event, int, int%29), [mouseUp](../../../../java/awt/Component.html#mouseUp%28java.awt.Event, int, int%29), [move](../../../../java/awt/Component.html#move%28int, int%29), nextFocus, paintAll, postEvent, [prepareImage](../../../../java/awt/Component.html#prepareImage%28java.awt.Image, java.awt.image.ImageObserver%29), [prepareImage](../../../../java/awt/Component.html#prepareImage%28java.awt.Image, int, int, java.awt.image.ImageObserver%29), printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, [removePropertyChangeListener](../../../../java/awt/Component.html#removePropertyChangeListener%28java.lang.String, java.beans.PropertyChangeListener%29), repaint, [repaint](../../../../java/awt/Component.html#repaint%28int, int, int, int%29), repaint, [repaint](../../../../java/awt/Component.html#repaint%28long, int, int, int, int%29), requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, [reshape](../../../../java/awt/Component.html#reshape%28int, int, int, int%29), resize, [resize](../../../../java/awt/Component.html#resize%28int, int%29), setBackground, [setBounds](../../../../java/awt/Component.html#setBounds%28int, int, int, int%29), setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, [setLocation](../../../../java/awt/Component.html#setLocation%28int, int%29), setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, [setSize](../../../../java/awt/Component.html#setSize%28int, int%29), setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, [wait](../../../../java/lang/Object.html#wait%28long, int%29) |
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.
See Also:
ONE_TOUCH_OFFSET
protected static final int ONE_TOUCH_OFFSET
See Also:
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
Handles mouse events from both this class, and the split pane. Mouse events are handled for the splitpane since you want to be able to drag when clicking on the border of the divider, which is not drawn by the divider.
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.
setBorder
public void setBorder(Border border)
Sets the border of this component.
Since:
1.3
getBorder
public Border getBorder()
Returns the border of this component or null if no border is currently set.
Returns:
the border object for this component
Since:
1.3
See Also:
setBorder(javax.swing.border.Border)
getInsets
public Insets getInsets()
If a border has been set on this component, returns the border's insets, else calls super.getInsets.
Overrides:
[getInsets](../../../../java/awt/Container.html#getInsets%28%29)
in class [Container](../../../../java/awt/Container.html "class in java.awt")
Returns:
the value of the insets property.
See Also:
setBorder(javax.swing.border.Border)
setMouseOver
protected void setMouseOver(boolean mouseOver)
Sets whether or not the mouse is currently over the divider.
Parameters:
mouseOver
- whether or not the mouse is currently over the divider
Since:
1.5
isMouseOver
public boolean isMouseOver()
Returns whether or not the mouse is currently over the divider
Parameters:
Returns
- whether or not the mouse is currently over the divider
getPreferredSize
public Dimension getPreferredSize()
Returns dividerSize x dividerSize
Overrides:
[getPreferredSize](../../../../java/awt/Container.html#getPreferredSize%28%29)
in class [Container](../../../../java/awt/Container.html "class in java.awt")
Returns:
an instance of Dimension
that represents the preferred size of this container.
See Also:
Container.getMinimumSize(), Container.getLayout(), LayoutManager.preferredLayoutSize(Container), Component.getPreferredSize()
getMinimumSize
public Dimension getMinimumSize()
Returns dividerSize x dividerSize
Overrides:
[getMinimumSize](../../../../java/awt/Container.html#getMinimumSize%28%29)
in class [Container](../../../../java/awt/Container.html "class in java.awt")
Returns:
an instance of Dimension
that represents the minimum size of this container.
See Also:
Container.getPreferredSize(), Container.getLayout(), LayoutManager.minimumLayoutSize(Container), Component.getMinimumSize()
propertyChange
public void propertyChange(PropertyChangeEvent e)
Property change event, presumably from the JSplitPane, will message updateOrientation if necessary.
Specified by:
[propertyChange](../../../../java/beans/PropertyChangeListener.html#propertyChange%28java.beans.PropertyChangeEvent%29)
in interface [PropertyChangeListener](../../../../java/beans/PropertyChangeListener.html "interface in java.beans")
Parameters:
e
- A PropertyChangeEvent object describing the event source and the property that has changed.
paint
public void paint(Graphics g)
Paints the divider.
Overrides:
[paint](../../../../java/awt/Container.html#paint%28java.awt.Graphics%29)
in class [Container](../../../../java/awt/Container.html "class in java.awt")
Parameters:
g
- the specified Graphics window
See Also:
oneTouchExpandableChanged
protected void oneTouchExpandableChanged()
Messaged when the oneTouchExpandable value of the JSplitPane the receiver is contained in changes. Will create theleftButton
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.
Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2004, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.