javax.swing.plaf.basic

Class BasicSplitPaneDivider

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.

Nested Class Summary
protected classBasicSplitPaneDivider.DividerLayout
This helper class acts as the Layout Manager for the divider.
protected classBasicSplitPaneDivider.DragController
Performs the tasks associated with an ongoing drag operation.
protected classBasicSplitPaneDivider.MouseHandler
The listener for handling mouse events from both the divider and the containing JSplitPane.
protected classBasicSplitPaneDivider.VerticalDragController
This is a helper class that controls dragging when the orientation is VERTICAL_SPLIT.
Field Summary
protected intdividerSize
The thickness of the divider in pixels.
protected BasicSplitPaneDivider.DragControllerdragger
An object that performs the tasks associated with an ongoing drag operation, or null if the user is currently not dragging the divider.
protected ComponenthiddenDivider
A divider that is used for layout purposes.
protected JButtonleftButton
The button for showing and hiding the left (or top) component of the JSplitPane.
protected BasicSplitPaneDivider.MouseHandlermouseHandler
The listener for handling mouse events from both the divider and the containing JSplitPane.
protected intorientation
The current orientation of the containing JSplitPane, which is either {@link javax.swing.JSplitPane#HORIZONTAL_SPLIT} or {@link javax.swing.JSplitPane#VERTICAL_SPLIT}.
protected static intONE_TOUCH_OFFSET
The distance the one touch buttons will sit from the divider's edges.
protected static intONE_TOUCH_SIZE
The width and height of the little buttons for showing and hiding parts of a JSplitPane in a single mouse click.
protected JButtonrightButton
The button for showing and hiding the right (or bottom) component of the JSplitPane.
protected JSplitPanesplitPane
The JSplitPane containing this divider.
protected BasicSplitPaneUIsplitPaneUI
The delegate object that is responsible for the UI of the JSplitPane that contains this divider.
Constructor Summary
BasicSplitPaneDivider(BasicSplitPaneUI ui)
Constructs a new divider.
Method Summary
protected JButtoncreateLeftOneTouchButton()
Creates a button for showing and hiding the left (or top) part of a JSplitPane.
protected JButtoncreateRightOneTouchButton()
Creates a button for showing and hiding the right (or bottom) part of a JSplitPane.
protected voiddragDividerTo(int location)
Drags the divider to a given location by calling the dragDividerTo method of the UI delegate of the enclosing JSplitPane.
protected voidfinishDraggingTo(int location)
Finishes a dragging gesture by calling the finishDraggingTo method of the UI delegate of the enclosing JSplitPane.
BasicSplitPaneUIgetBasicSplitPaneUI()
Returns the delegate object that is responsible for the UI of the {@link javax.swing.JSplitPane} containing this divider.
BordergetBorder()
Retrieves the border of this divider.
intgetDividerSize()
Retrieves the thickness of the divider.
InsetsgetInsets()
Retrieves the insets of the divider.
DimensiongetMinimumSize()
Returns the minimal size of this divider, which is dividerSize by dividerSize pixels.
DimensiongetPreferredSize()
Returns the preferred size of this divider, which is dividerSize by dividerSize pixels.
protected voidoneTouchExpandableChanged()
Reacts to changes of the oneToughExpandable property of the containing JSplitPane.
voidpaint(Graphics g)
Paints the divider by painting its border.
protected voidprepareForDragging()
Prepares the divider for dragging by calling the startDragging method of the UI delegate of the enclosing JSplitPane.
voidpropertyChange(PropertyChangeEvent e)
Processes events from the JSplitPane that contains this divider.
voidsetBasicSplitPaneUI(BasicSplitPaneUI newUI)
Sets the delegate object that is responsible for the UI of the {@link javax.swing.JSplitPane} containing this divider.
voidsetBorder(Border border)
Sets the border of this divider.
voidsetDividerSize(int newSize)
Sets the thickness of the divider.

Field Detail

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 {@link javax.swing.JSplitPane#HORIZONTAL_SPLIT} or {@link javax.swing.JSplitPane#VERTICAL_SPLIT}.

ONE_TOUCH_OFFSET

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

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.

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 Detail

BasicSplitPaneDivider

public BasicSplitPaneDivider(BasicSplitPaneUI ui)
Constructs a new divider.

Parameters: ui the UI delegate of the enclosing JSplitPane.

Method Detail

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

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

getBasicSplitPaneUI

public BasicSplitPaneUI getBasicSplitPaneUI()
Returns the delegate object that is responsible for the UI of the {@link javax.swing.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.

See Also: getBorderInsets

getMinimumSize

public Dimension getMinimumSize()
Returns the minimal size of this divider, which is dividerSize by dividerSize pixels.

Returns: The minimal size of the divider.

getPreferredSize

public Dimension getPreferredSize()
Returns the preferred size of this divider, which is dividerSize by dividerSize pixels.

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.

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.

See Also: startDragging

propertyChange

public void propertyChange(PropertyChangeEvent e)
Processes events from the JSplitPane that contains this divider.

Parameters: e The PropertyChangeEvent.

setBasicSplitPaneUI

public void setBasicSplitPaneUI(BasicSplitPaneUI newUI)
Sets the delegate object that is responsible for the UI of the {@link javax.swing.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 {@link javax.swing.plaf.basic.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.