javax.swing.plaf.basic

Class BasicSplitPaneDivider

Implemented Interfaces:
EventListener, ImageObserver, MenuContainer, PropertyChangeListener, Serializable

public class BasicSplitPaneDivider
extends Container
implements PropertyChangeListener

The divider that separates the two parts of a JSplitPane in the Basic look and feel.

Implementation status: We do not have a real implementation yet. Currently, it is mostly a stub to allow compiling other parts of the javax.swing.plaf.basic package, although some parts are already functional.

See Also:
Serialized Form

Nested Class Summary

protected class
BasicSplitPaneDivider.DividerLayout
This helper class acts as the Layout Manager for the divider.
protected class
BasicSplitPaneDivider.DragController
Performs the tasks associated with an ongoing drag operation.
protected class
BasicSplitPaneDivider.MouseHandler
The listener for handling mouse events from both the divider and the containing JSplitPane.
protected class
BasicSplitPaneDivider.VerticalDragController
This is a helper class that controls dragging when the orientation is VERTICAL_SPLIT.

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 static int
ONE_TOUCH_OFFSET
The distance the one touch buttons will sit from the divider's edges.
protected static int
ONE_TOUCH_SIZE
The width and height of the little buttons for showing and hiding parts of a JSplitPane in a single mouse click.
protected int
dividerSize
The thickness of the divider in pixels.
protected BasicSplitPaneDivider.DragController
dragger
An object that performs the tasks associated with an ongoing drag operation, or null if the user is currently not dragging the divider.
protected Component
hiddenDivider
A divider that is used for layout purposes.
protected JButton
leftButton
The button for showing and hiding the left (or top) component of the JSplitPane.
protected BasicSplitPaneDivider.MouseHandler
mouseHandler
The listener for handling mouse events from both the divider and the containing JSplitPane.
protected int
orientation
The current orientation of the containing JSplitPane, which is either JSplitPane.HORIZONTAL_SPLIT or JSplitPane.VERTICAL_SPLIT.
protected JButton
rightButton
The button for showing and hiding the right (or bottom) component of the JSplitPane.
protected JSplitPane
splitPane
The JSplitPane containing this divider.
protected BasicSplitPaneUI
splitPaneUI
The delegate object that is responsible for the UI of the JSplitPane that contains this divider.

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)
Constructs a new divider.

Method Summary

protected JButton
createLeftOneTouchButton()
Creates a button for showing and hiding the left (or top) part of a JSplitPane.
protected JButton
createRightOneTouchButton()
Creates a button for showing and hiding the right (or bottom) part of a JSplitPane.
protected void
dragDividerTo(int location)
Drags the divider to a given location by calling the dragDividerTo method of the UI delegate of the enclosing JSplitPane.
protected void
finishDraggingTo(int location)
Finishes a dragging gesture by calling the finishDraggingTo method of the UI delegate of the enclosing JSplitPane.
BasicSplitPaneUI
getBasicSplitPaneUI()
Returns the delegate object that is responsible for the UI of the JSplitPane containing this divider.
Border
getBorder()
Retrieves the border of this divider.
int
getDividerSize()
Retrieves the thickness of the divider.
Insets
getInsets()
Retrieves the insets of the divider.
Dimension
getMinimumSize()
Returns the minimal size of this divider, which is dividerSize by dividerSize pixels.
Dimension
getPreferredSize()
Returns the preferred size of this divider, which is dividerSize by dividerSize pixels.
protected void
oneTouchExpandableChanged()
Reacts to changes of the oneToughExpandable property of the containing JSplitPane.
void
paint(Graphics g)
Paints the divider by painting its border.
protected void
prepareForDragging()
Prepares the divider for dragging by calling the startDragging method of the UI delegate of the enclosing JSplitPane.
void
propertyChange(PropertyChangeEvent e)
Processes events from the JSplitPane that contains this divider.
void
setBasicSplitPaneUI(BasicSplitPaneUI newUI)
Sets the delegate object that is responsible for the UI of the JSplitPane containing this divider.
void
setBorder(Border border)
Sets the border of this divider.
void
setDividerSize(int newSize)
Sets the thickness of the divider.

Methods inherited from class java.awt.Container

add, add, add, add, add, addContainerListener, addImpl, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, extends EventListener> T[] getListeners, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponentZOrder, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, update, validate, validateTree

Methods inherited from class java.awt.Component

action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, extends EventListener> T[] getListeners, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFocusable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, 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, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFocusable, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

ONE_TOUCH_OFFSET

protected static final int ONE_TOUCH_OFFSET
The distance the one touch buttons will sit from the divider's edges.
Field Value:
2

ONE_TOUCH_SIZE

protected static final int ONE_TOUCH_SIZE
The width and height of the little buttons for showing and hiding parts of a JSplitPane in a single mouse click.
Field Value:
6

dividerSize

protected int dividerSize
The thickness of the divider in pixels.

dragger

protected BasicSplitPaneDivider.DragController dragger
An object that performs the tasks associated with an ongoing drag operation, or null if the user is currently not dragging the divider.

hiddenDivider

protected Component hiddenDivider
A divider that is used for layout purposes.

leftButton

protected JButton leftButton
The button for showing and hiding the left (or top) component of the JSplitPane.

mouseHandler

protected BasicSplitPaneDivider.MouseHandler mouseHandler
The listener for handling mouse events from both the divider and the containing JSplitPane.

The reason for also handling MouseEvents from the containing JSplitPane is that users should be able to start a drag gesture from inside the JSplitPane, but slightly outisde the divider.


orientation

protected int orientation
The current orientation of the containing JSplitPane, which is either JSplitPane.HORIZONTAL_SPLIT or JSplitPane.VERTICAL_SPLIT.

rightButton

protected JButton rightButton
The button for showing and hiding the right (or bottom) component of the JSplitPane.

splitPane

protected JSplitPane splitPane
The JSplitPane containing this divider.

splitPaneUI

protected BasicSplitPaneUI splitPaneUI
The delegate object that is responsible for the UI of the JSplitPane that contains this divider.

Constructor Details

BasicSplitPaneDivider

public BasicSplitPaneDivider(BasicSplitPaneUI ui)
Constructs a new divider.
Parameters:
ui - the UI delegate of the enclosing JSplitPane.

Method Details

createLeftOneTouchButton

protected JButton createLeftOneTouchButton()
Creates a button for showing and hiding the left (or top) part of a JSplitPane.
Returns:
The left one touch button.

createRightOneTouchButton

protected JButton createRightOneTouchButton()
Creates a button for showing and hiding the right (or bottom) part of a JSplitPane.
Returns:
The right one touch button.

dragDividerTo

protected void dragDividerTo(int location)
Drags the divider to a given location by calling the dragDividerTo method of the UI delegate of the enclosing JSplitPane.
Parameters:
location - the new location of the divider.
See Also:
BasicSplitPaneUI.dragDividerTo(int location)

finishDraggingTo

protected void finishDraggingTo(int location)
Finishes a dragging gesture by calling the finishDraggingTo method of the UI delegate of the enclosing JSplitPane.
Parameters:
location - the new, final location of the divider.
See Also:
BasicSplitPaneUI.finishDraggingTo(int location)

getBasicSplitPaneUI

public BasicSplitPaneUI getBasicSplitPaneUI()
Returns the delegate object that is responsible for the UI of the JSplitPane containing this divider.
Returns:
The UI for the JSplitPane.

getBorder

public Border getBorder()
Retrieves the border of this divider.
Returns:
the current border, or null if no border has been set.
Since:
1.3

getDividerSize

public int getDividerSize()
Retrieves the thickness of the divider.
Returns:
The thickness of the divider.

getInsets

public Insets getInsets()
Retrieves the insets of the divider. If a border has been installed on the divider, the result of calling its getBorderInsets method is returned. Otherwise, the inherited implementation will be invoked.
Overrides:
getInsets in interface Container

getMinimumSize

public Dimension getMinimumSize()
Returns the minimal size of this divider, which is dividerSize by dividerSize pixels.
Overrides:
getMinimumSize in interface Container
Returns:
The minimal size of the divider.

getPreferredSize

public Dimension getPreferredSize()
Returns the preferred size of this divider, which is dividerSize by dividerSize pixels.
Overrides:
getPreferredSize in interface Container
Returns:
The preferred size of the divider.

oneTouchExpandableChanged

protected void oneTouchExpandableChanged()
Reacts to changes of the oneToughExpandable property of the containing JSplitPane.

paint

public void paint(Graphics g)
Paints the divider by painting its border.
Overrides:
paint in interface Container
Parameters:
g - The Graphics Object to paint with.

prepareForDragging

protected void prepareForDragging()
Prepares the divider for dragging by calling the startDragging method of the UI delegate of the enclosing JSplitPane.

propertyChange

public void propertyChange(PropertyChangeEvent e)
Processes events from the JSplitPane that contains this divider.
Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
e - The PropertyChangeEvent.

setBasicSplitPaneUI

public void setBasicSplitPaneUI(BasicSplitPaneUI newUI)
Sets the delegate object that is responsible for the UI of the JSplitPane containing this divider.
Parameters:
newUI - the UI delegate, or null to release the connection to the current delegate.

setBorder

public void setBorder(Border border)
Sets the border of this divider.
Parameters:
border - the new border. Typically, this will be an instance of BasicBorders.SplitPaneBorder.
Since:
1.3

setDividerSize

public void setDividerSize(int newSize)
Sets the thickness of the divider.
Parameters:
newSize - the new width or height in pixels.

BasicSplitPaneDivider.java -- Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.