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 JavaBeans™
 has been added to the java.beans package.
 Please see XMLEncoder.
- 
Nested Class SummaryNested Classes Modifier and Type Class Description protected classBasicSplitPaneDivider.DividerLayoutUsed to layout aBasicSplitPaneDivider.protected classBasicSplitPaneDivider.DragControllerHandles the events during a dragging session for a HORIZONTAL_SPLIT oriented split pane.protected classBasicSplitPaneDivider.MouseHandlerMouseHandler is responsible for converting mouse events (released, dragged...) into the appropriate DragController methods.protected classBasicSplitPaneDivider.VerticalDragControllerHandles the events during a dragging session for a VERTICAL_SPLIT oriented split pane.Nested classes/interfaces declared in class java.awt.ComponentComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
- 
Field SummaryFields Modifier and Type Field Description protected intdividerSizeSize of the divider.protected BasicSplitPaneDivider.DragControllerdraggerHandles mouse dragging message to do the actual dragging.protected ComponenthiddenDividerDivider that is used for noncontinuous layout mode.protected JButtonleftButtonButton for quickly toggling the left component.protected BasicSplitPaneDivider.MouseHandlermouseHandlerHandles mouse events from both this class, and the split pane.protected static intONE_TOUCH_OFFSETThe offset of the divider.protected static intONE_TOUCH_SIZEWidth or height of the divider based on orientationBasicSplitPaneUIadds two to this.protected intorientationOrientation of the JSplitPane.protected JButtonrightButtonButton for quickly toggling the right component.protected JSplitPanesplitPaneJSplitPane the receiver is contained in.protected BasicSplitPaneUIsplitPaneUIUI this instance was created from.Fields declared in class java.awt.ComponentaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields declared in interface java.awt.image.ImageObserverABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
- 
Constructor SummaryConstructors Constructor Description BasicSplitPaneDivider(BasicSplitPaneUI ui)Creates an instance ofBasicSplitPaneDivider.
- 
Method SummaryModifier and Type Method Description protected JButtoncreateLeftOneTouchButton()Creates and return an instance ofJButtonthat can be used to collapse the left component in the split pane.protected JButtoncreateRightOneTouchButton()Creates and return an instance ofJButtonthat can be used to collapse the right component in the split pane.protected voiddragDividerTo(int location)Messages the BasicSplitPaneUI with dragDividerTo that this instance is contained in.protected voidfinishDraggingTo(int location)Messages the BasicSplitPaneUI with finishDraggingTo that this instance is contained in.BasicSplitPaneUIgetBasicSplitPaneUI()Returns theSplitPaneUIthe receiver is currently in.BordergetBorder()Returns the border of this component or null if no border is currently set.intgetDividerSize()Returns the size of the divider, that is the width if the splitpane is HORIZONTAL_SPLIT, or the height of VERTICAL_SPLIT.InsetsgetInsets()If a border has been set on this component, returns the border's insets, else calls super.getInsets.DimensiongetMinimumSize()Returns dividerSize x dividerSizeDimensiongetPreferredSize()Returns dividerSize x dividerSizebooleanisMouseOver()Returns whether or not the mouse is currently over the dividerprotected voidoneTouchExpandableChanged()Messaged when the oneTouchExpandable value of the JSplitPane the receiver is contained in changes.voidpaint(Graphics g)Paints the divider.protected voidprepareForDragging()Message to prepare for dragging.voidpropertyChange(PropertyChangeEvent e)Property change event, presumably from the JSplitPane, will message updateOrientation if necessary.voidsetBasicSplitPaneUI(BasicSplitPaneUI newUI)Sets theSplitPaneUIthat is using the receiver.voidsetBorder(Border border)Sets the border of this component.voidsetDividerSize(int newSize)Sets the size of the divider tonewSize.protected voidsetMouseOver(boolean mouseOver)Sets whether or not the mouse is currently over the divider.Methods declared in class java.awt.Containeradd, add, add, add, add, addContainerListener, addImpl, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getListeners, getMaximumSize, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, isValidateRoot, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, update, validate, validateTreeMethods declared in class java.awt.Componentaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBaseline, getBaselineResizeBehavior, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, 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, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setMixingCutoutShape, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
- 
Field Details- 
ONE_TOUCH_SIZEprotected static final int ONE_TOUCH_SIZEWidth or height of the divider based on orientationBasicSplitPaneUIadds two to this.- See Also:
- Constant Field Values
 
- 
ONE_TOUCH_OFFSETprotected static final int ONE_TOUCH_OFFSETThe offset of the divider.- See Also:
- Constant Field Values
 
- 
draggerHandles mouse dragging message to do the actual dragging.
- 
splitPaneUIUI this instance was created from.
- 
dividerSizeprotected int dividerSizeSize of the divider.
- 
Divider that is used for noncontinuous layout mode.
- 
splitPaneJSplitPane the receiver is contained in.
- 
mouseHandlerHandles 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.
- 
orientationprotected int orientationOrientation of the JSplitPane.
- 
leftButtonButton for quickly toggling the left component.
- 
rightButtonButton for quickly toggling the right component.
 
- 
- 
Constructor Details- 
BasicSplitPaneDividerCreates an instance ofBasicSplitPaneDivider. Registers this instance for mouse events and mouse dragged events.- Parameters:
- ui- an instance of- BasicSplitPaneUI
 
 
- 
- 
Method Details- 
setBasicSplitPaneUISets theSplitPaneUIthat is using the receiver.- Parameters:
- newUI- the new- SplitPaneUI
 
- 
getBasicSplitPaneUIReturns theSplitPaneUIthe receiver is currently in.- Returns:
- the SplitPaneUIthe receiver is currently in
 
- 
setDividerSizepublic void setDividerSize(int newSize)Sets the size of the divider tonewSize. That is the width if the splitpane isHORIZONTAL_SPLIT, or the height ofVERTICAL_SPLIT.- Parameters:
- newSize- a new size
 
- 
getDividerSizepublic int getDividerSize()Returns the size of the divider, that is the width if the splitpane is HORIZONTAL_SPLIT, or the height of VERTICAL_SPLIT.- Returns:
- the size of the divider
 
- 
setBorderSets the border of this component.- Parameters:
- border- a new border
- Since:
- 1.3
 
- 
getBorderReturns 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)
 
- 
getInsetsIf a border has been set on this component, returns the border's insets, else calls super.getInsets.- Overrides:
- getInsetsin class- Container
- Returns:
- the value of the insets property.
- See Also:
- setBorder(javax.swing.border.Border)
 
- 
setMouseOverprotected 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
 
- 
isMouseOverpublic boolean isMouseOver()Returns whether or not the mouse is currently over the divider- Returns:
- whether or not the mouse is currently over the divider
- Since:
- 1.5
 
- 
getPreferredSizeReturns dividerSize x dividerSize- Overrides:
- getPreferredSizein class- Container
- Returns:
- an instance of Dimensionthat represents the preferred size of this container.
- See Also:
- Container.getMinimumSize(),- Container.getMaximumSize(),- Container.getLayout(),- LayoutManager.preferredLayoutSize(Container),- Component.getPreferredSize()
 
- 
getMinimumSizeReturns dividerSize x dividerSize- Overrides:
- getMinimumSizein class- Container
- Returns:
- an instance of Dimensionthat represents the minimum size of this container.
- See Also:
- Container.getPreferredSize(),- Container.getMaximumSize(),- Container.getLayout(),- LayoutManager.minimumLayoutSize(Container),- Component.getMinimumSize()
 
- 
propertyChangeProperty change event, presumably from the JSplitPane, will message updateOrientation if necessary.- Specified by:
- propertyChangein interface- PropertyChangeListener
- Parameters:
- e- A PropertyChangeEvent object describing the event source and the property that has changed.
 
- 
paintPaints the divider.- Overrides:
- paintin class- Container
- Parameters:
- g- the specified Graphics window
- See Also:
- Component.update(Graphics)
 
- 
oneTouchExpandableChangedprotected void oneTouchExpandableChanged()Messaged when the oneTouchExpandable value of the JSplitPane the receiver is contained in changes. Will create theleftButtonandrightButtonif they are null. invalidates the receiver as well.
- 
createLeftOneTouchButtonCreates and return an instance ofJButtonthat can be used to collapse the left component in the split pane.- Returns:
- an instance of JButton
 
- 
createRightOneTouchButtonCreates and return an instance ofJButtonthat can be used to collapse the right component in the split pane.- Returns:
- an instance of JButton
 
- 
prepareForDraggingprotected void prepareForDragging()Message to prepare for dragging. This messages the BasicSplitPaneUI with startDragging.
- 
dragDividerToprotected void dragDividerTo(int location)Messages the BasicSplitPaneUI with dragDividerTo that this instance is contained in.- Parameters:
- location- a location
 
- 
finishDraggingToprotected void finishDraggingTo(int location)Messages the BasicSplitPaneUI with finishDraggingTo that this instance is contained in.- Parameters:
- location- a location
 
 
-