javax.swing.plaf.basic

Class BasicSplitPaneUI

public class BasicSplitPaneUI extends SplitPaneUI

This is the Basic Look and Feel implementation of the SplitPaneUI class.
Nested Class Summary
classBasicSplitPaneUI.BasicHorizontalLayoutManager
This Layout Manager controls the position and size of the components when the JSplitPane's orientation is HORIZONTAL_SPLIT.
classBasicSplitPaneUI.BasicVerticalLayoutManager
This class is the Layout Manager for the JSplitPane when the orientation is VERTICAL_SPLIT.
classBasicSplitPaneUI.FocusHandler
This class handles FocusEvents from the JComponent.
classBasicSplitPaneUI.KeyboardDownRightHandler
This is a deprecated class.
classBasicSplitPaneUI.KeyboardEndHandler
This is a deprecated class.
classBasicSplitPaneUI.KeyboardHomeHandler
This is a deprecated class.
classBasicSplitPaneUI.KeyboardResizeToggleHandler
This is a deprecated class.
classBasicSplitPaneUI.KeyboardUpLeftHandler
This is a deprecated class.
classBasicSplitPaneUI.PropertyHandler
This helper class handles PropertyChangeEvents from the JSplitPane.
Field Summary
protected intbeginDragDividerLocation
The location of the divider when dragging began.
protected BasicSplitPaneDividerdivider
The divider that divides this JSplitPane.
protected KeyStrokedividerResizeToggleKey
protected intdividerSize
The size of the divider while dragging.
protected KeyStrokedownKey
protected booleandraggingHW
Set to true when dragging heavy weight components.
protected KeyStrokeendKey
protected FocusListenerfocusListener
The JSplitPane's focus handler.
protected KeyStrokehomeKey
protected ActionListenerkeyboardDownRightListener
protected ActionListenerkeyboardEndListener
protected ActionListenerkeyboardHomeListener
protected ActionListenerkeyboardResizeToggleListener
protected ActionListenerkeyboardUpLeftListener
protected static intKEYBOARD_DIVIDER_MOVE_OFFSET
The distance the divider is moved when moved by keyboard actions.
protected BasicSplitPaneUI.BasicHorizontalLayoutManagerlayoutManager
The JSplitPane's current layout manager.
protected KeyStrokeleftKey
protected ComponentnonContinuousLayoutDivider
The dark divider used when dragging in non-continuous layout mode.
protected static StringNON_CONTINUOUS_DIVIDER
The constraints object used when adding the non-continuous divider to the JSplitPane.
protected PropertyChangeListenerpropertyChangeListener
The listener that listens for PropertyChangeEvents from the JSplitPane.
protected KeyStrokerightKey
protected JSplitPanesplitPane
The JSplitPane that this UI draws.
protected KeyStrokeupKey
Constructor Summary
BasicSplitPaneUI()
Creates a new BasicSplitPaneUI object.
Method Summary
BasicSplitPaneDividercreateDefaultDivider()
This method creates the divider used normally with the JSplitPane.
protected ComponentcreateDefaultNonContinuousLayoutDivider()
This method creates a nonContinuousLayoutDivider for use with the JSplitPane in nonContinousLayout mode.
protected FocusListenercreateFocusListener()
This method creates a new FocusListener.
protected ActionListenercreateKeyboardDownRightListener()
This method creates a new ActionListener for down and right key presses.
protected ActionListenercreateKeyboardEndListener()
This method creates a new ActionListener for end key presses.i
protected ActionListenercreateKeyboardHomeListener()
This method creates a new ActionListener for home key presses.
protected ActionListenercreateKeyboardResizeToggleListener()
This method creates a new ActionListener for resize toggle key events.
protected ActionListenercreateKeyboardUpLeftListener()
This method creates a new ActionListener for up and left key presses.
protected PropertyChangeListenercreatePropertyChangeListener()
This method creates a new PropertyChangeListener.
static ComponentUIcreateUI(JComponent x)
This method creates a new BasicSplitPaneUI for the given JComponent.
protected voiddragDividerTo(int location)
This method is called whenever the divider is dragged.
protected voidfinishDraggingTo(int location)
This method is called when the dragging is finished.
voidfinishedPaintingChildren(JSplitPane jc, Graphics g)
This method is called after the children of the JSplitPane are painted.
BasicSplitPaneDividergetDivider()
This method returns the BasicSplitPaneDivider that divides this JSplitPane.
protected intgetDividerBorderSize()
This method returns the width of one of the sides of the divider's border.
intgetDividerLocation(JSplitPane jc)
This method returns the location of the divider.
InsetsgetInsets(JComponent jc)
This method returns the border insets of the current border.
intgetLastDragLocation()
This method returns the last location the divider was dragged to.
intgetMaximumDividerLocation(JSplitPane jc)
This method returns the largest value possible for the location of the divider.
DimensiongetMaximumSize(JComponent jc)
This method returns the maximum size of the JSplitPane.
intgetMinimumDividerLocation(JSplitPane jc)
This method returns the smallest value possible for the location of the divider.
DimensiongetMinimumSize(JComponent jc)
This method returns the minimum size of the JSplitPane.
ComponentgetNonContinuousLayoutDivider()
This method returns the nonContinuousLayoutDivider.
intgetOrientation()
This method returns the orientation of the JSplitPane.
DimensiongetPreferredSize(JComponent jc)
This method returns the preferred size of the JSplitPane.
JSplitPanegetSplitPane()
This method returns the JSplitPane that this BasicSplitPaneUI draws.
protected voidinstallDefaults()
This method installs the defaults given by the Look and Feel.
protected voidinstallKeyboardActions()
Installs any keyboard actions.
protected voidinstallListeners()
This method installs the listeners needed for this UI to function.
voidinstallUI(JComponent c)
This method installs the BasicSplitPaneUI for the given JComponent.
booleanisContinuousLayout()
This method returns true if the JSplitPane is using continuous layout.
voidpaint(Graphics g, JComponent jc)
This method is called to paint the JSplitPane.
protected voidresetLayoutManager()
This method resets the current layout manager.
voidresetToPreferredSizes(JSplitPane jc)
This method is called when JSplitPane's resetToPreferredSizes is called.
voidsetContinuousLayout(boolean b)
This method sets the continuous layout property of the JSplitPane.
voidsetDividerLocation(JSplitPane jc, int location)
This method sets the location of the divider.
voidsetLastDragLocation(int l)
This method sets the last location the divider was dragged to.
protected voidsetNonContinuousLayoutDivider(Component newDivider)
This method sets the component to use as the nonContinuousLayoutDivider.
protected voidsetNonContinuousLayoutDivider(Component newDivider, boolean rememberSizes)
This method sets the component to use as the nonContinuousLayoutDivider.
voidsetOrientation(int orientation)
This method sets the orientation of the JSplitPane.
protected voidstartDragging()
This method is called when dragging starts.
protected voiduninstallDefaults()
This method uninstalls the defaults and nulls any objects created during install.
protected voiduninstallKeyboardActions()
This method reverses the work done in installKeyboardActions.
protected voiduninstallListeners()
This method uninstalls all listeners registered for the UI.
voiduninstallUI(JComponent c)
This method uninstalls the BasicSplitPaneUI for the given JComponent.

Field Detail

beginDragDividerLocation

protected int beginDragDividerLocation
The location of the divider when dragging began.

divider

protected BasicSplitPaneDivider divider
The divider that divides this JSplitPane.

dividerResizeToggleKey

protected KeyStroke dividerResizeToggleKey

Deprecated: The divider resize toggle key.

dividerSize

protected int dividerSize
The size of the divider while dragging.

downKey

protected KeyStroke downKey

Deprecated: The down key.

draggingHW

protected boolean draggingHW
Set to true when dragging heavy weight components.

endKey

protected KeyStroke endKey

Deprecated: The end key.

focusListener

protected FocusListener focusListener
The JSplitPane's focus handler.

homeKey

protected KeyStroke homeKey

Deprecated: The home key.

keyboardDownRightListener

protected ActionListener keyboardDownRightListener

Deprecated: The handler for down and right key presses.

keyboardEndListener

protected ActionListener keyboardEndListener

Deprecated: The handler for end key presses.

keyboardHomeListener

protected ActionListener keyboardHomeListener

Deprecated: The handler for home key presses.

keyboardResizeToggleListener

protected ActionListener keyboardResizeToggleListener

Deprecated: The handler for toggling resizes.

keyboardUpLeftListener

protected ActionListener keyboardUpLeftListener

Deprecated: The handler for up and left key presses.

KEYBOARD_DIVIDER_MOVE_OFFSET

protected static int KEYBOARD_DIVIDER_MOVE_OFFSET
The distance the divider is moved when moved by keyboard actions.

layoutManager

protected BasicSplitPaneUI.BasicHorizontalLayoutManager layoutManager
The JSplitPane's current layout manager.

leftKey

protected KeyStroke leftKey

Deprecated: The left key.

nonContinuousLayoutDivider

protected Component nonContinuousLayoutDivider
The dark divider used when dragging in non-continuous layout mode.

NON_CONTINUOUS_DIVIDER

protected static final String NON_CONTINUOUS_DIVIDER
The constraints object used when adding the non-continuous divider to the JSplitPane.

propertyChangeListener

protected PropertyChangeListener propertyChangeListener
The listener that listens for PropertyChangeEvents from the JSplitPane.

rightKey

protected KeyStroke rightKey

Deprecated: The right key.

splitPane

protected JSplitPane splitPane
The JSplitPane that this UI draws.

upKey

protected KeyStroke upKey

Deprecated: The up key.

Constructor Detail

BasicSplitPaneUI

public BasicSplitPaneUI()
Creates a new BasicSplitPaneUI object.

Method Detail

createDefaultDivider

public BasicSplitPaneDivider createDefaultDivider()
This method creates the divider used normally with the JSplitPane.

Returns: The default divider.

createDefaultNonContinuousLayoutDivider

protected Component createDefaultNonContinuousLayoutDivider()
This method creates a nonContinuousLayoutDivider for use with the JSplitPane in nonContinousLayout mode. The default divider is a gray Canvas.

Returns: The default nonContinousLayoutDivider.

createFocusListener

protected FocusListener createFocusListener()
This method creates a new FocusListener.

Returns: A new FocusListener.

createKeyboardDownRightListener

protected ActionListener createKeyboardDownRightListener()

Deprecated: 1.3

This method creates a new ActionListener for down and right key presses.

Returns: A new ActionListener for down and right keys.

createKeyboardEndListener

protected ActionListener createKeyboardEndListener()

Deprecated: 1.3

This method creates a new ActionListener for end key presses.i

Returns: A new ActionListener for end keys.

createKeyboardHomeListener

protected ActionListener createKeyboardHomeListener()

Deprecated:

This method creates a new ActionListener for home key presses.

Returns: A new ActionListener for home keys.

createKeyboardResizeToggleListener

protected ActionListener createKeyboardResizeToggleListener()

Deprecated: 1.3

This method creates a new ActionListener for resize toggle key events.

Returns: A new ActionListener for resize toggle keys.

createKeyboardUpLeftListener

protected ActionListener createKeyboardUpLeftListener()

Deprecated: 1.3

This method creates a new ActionListener for up and left key presses.

Returns: A new ActionListener for up and left keys.

createPropertyChangeListener

protected PropertyChangeListener createPropertyChangeListener()
This method creates a new PropertyChangeListener.

Returns: A new PropertyChangeListener.

createUI

public static ComponentUI createUI(JComponent x)
This method creates a new BasicSplitPaneUI for the given JComponent.

Parameters: x The JComponent to create a UI for.

Returns: A new BasicSplitPaneUI.

dragDividerTo

protected void dragDividerTo(int location)
This method is called whenever the divider is dragged. If the JSplitPane is in continuousLayout mode, the divider needs to be moved and the JSplitPane needs to be laid out.

Parameters: location The new location of the divider.

finishDraggingTo

protected void finishDraggingTo(int location)
This method is called when the dragging is finished.

Parameters: location The location where the drag finished.

finishedPaintingChildren

public void finishedPaintingChildren(JSplitPane jc, Graphics g)
This method is called after the children of the JSplitPane are painted.

Parameters: jc The JSplitPane. g The Graphics object to paint with.

getDivider

public BasicSplitPaneDivider getDivider()
This method returns the BasicSplitPaneDivider that divides this JSplitPane.

Returns: The divider for the JSplitPane.

getDividerBorderSize

protected int getDividerBorderSize()

Deprecated: 1.3

This method returns the width of one of the sides of the divider's border.

Returns: The width of one side of the divider's border.

getDividerLocation

public int getDividerLocation(JSplitPane jc)
This method returns the location of the divider.

Parameters: jc The JSplitPane to retrieve the location for.

Returns: The location of the divider.

getInsets

public Insets getInsets(JComponent jc)
This method returns the border insets of the current border.

Parameters: jc The JSplitPane.

Returns: The current border insets.

getLastDragLocation

public int getLastDragLocation()
This method returns the last location the divider was dragged to.

Returns: The last location the divider was dragged to.

getMaximumDividerLocation

public int getMaximumDividerLocation(JSplitPane jc)
This method returns the largest value possible for the location of the divider.

Parameters: jc The JSplitPane.

Returns: The maximum divider location.

getMaximumSize

public Dimension getMaximumSize(JComponent jc)
This method returns the maximum size of the JSplitPane.

Parameters: jc The JSplitPane.

Returns: The maximum size of the JSplitPane.

getMinimumDividerLocation

public int getMinimumDividerLocation(JSplitPane jc)
This method returns the smallest value possible for the location of the divider.

Parameters: jc The JSplitPane.

Returns: The minimum divider location.

getMinimumSize

public Dimension getMinimumSize(JComponent jc)
This method returns the minimum size of the JSplitPane.

Parameters: jc The JSplitPane.

Returns: The minimum size of the JSplitPane.

getNonContinuousLayoutDivider

public Component getNonContinuousLayoutDivider()
This method returns the nonContinuousLayoutDivider.

Returns: The nonContinuousLayoutDivider.

getOrientation

public int getOrientation()
This method returns the orientation of the JSplitPane.

Returns: The orientation of the JSplitPane.

getPreferredSize

public Dimension getPreferredSize(JComponent jc)
This method returns the preferred size of the JSplitPane.

Parameters: jc The JSplitPane.

Returns: The preferred size of the JSplitPane.

getSplitPane

public JSplitPane getSplitPane()
This method returns the JSplitPane that this BasicSplitPaneUI draws.

Returns: The JSplitPane.

installDefaults

protected void installDefaults()
This method installs the defaults given by the Look and Feel.

installKeyboardActions

protected void installKeyboardActions()
Installs any keyboard actions. The list of keys that need to be bound are listed in Basic look and feel's defaults.

installListeners

protected void installListeners()
This method installs the listeners needed for this UI to function.

installUI

public void installUI(JComponent c)
This method installs the BasicSplitPaneUI for the given JComponent.

Parameters: c The JComponent to install the UI for.

isContinuousLayout

public boolean isContinuousLayout()
This method returns true if the JSplitPane is using continuous layout.

Returns: True if the JSplitPane is using continuous layout.

paint

public void paint(Graphics g, JComponent jc)
This method is called to paint the JSplitPane.

Parameters: g The Graphics object to paint with. jc The JSplitPane to paint.

resetLayoutManager

protected void resetLayoutManager()
This method resets the current layout manager. The type of layout manager is dependent on the current orientation.

resetToPreferredSizes

public void resetToPreferredSizes(JSplitPane jc)
This method is called when JSplitPane's resetToPreferredSizes is called. It resets the sizes of all components in the JSplitPane.

Parameters: jc The JSplitPane to reset.

setContinuousLayout

public void setContinuousLayout(boolean b)
This method sets the continuous layout property of the JSplitPane.

Parameters: b True if the JsplitPane is to use continuous layout.

setDividerLocation

public void setDividerLocation(JSplitPane jc, int location)
This method sets the location of the divider.

Parameters: jc The JSplitPane to set the divider location in. location The new location of the divider.

setLastDragLocation

public void setLastDragLocation(int l)
This method sets the last location the divider was dragged to.

Parameters: l The last location the divider was dragged to.

setNonContinuousLayoutDivider

protected void setNonContinuousLayoutDivider(Component newDivider)
This method sets the component to use as the nonContinuousLayoutDivider.

Parameters: newDivider The component to use as the nonContinuousLayoutDivider.

setNonContinuousLayoutDivider

protected void setNonContinuousLayoutDivider(Component newDivider, boolean rememberSizes)
This method sets the component to use as the nonContinuousLayoutDivider.

Parameters: newDivider The component to use as the nonContinuousLayoutDivider. rememberSizes FIXME: document.

setOrientation

public void setOrientation(int orientation)
This method sets the orientation of the JSplitPane.

Parameters: orientation The new orientation of the JSplitPane.

startDragging

protected void startDragging()
This method is called when dragging starts. It resets lastDragLocation and dividerSize.

uninstallDefaults

protected void uninstallDefaults()
This method uninstalls the defaults and nulls any objects created during install.

uninstallKeyboardActions

protected void uninstallKeyboardActions()
This method reverses the work done in installKeyboardActions.

uninstallListeners

protected void uninstallListeners()
This method uninstalls all listeners registered for the UI.

uninstallUI

public void uninstallUI(JComponent c)
This method uninstalls the BasicSplitPaneUI for the given JComponent.

Parameters: c The JComponent to uninstall the UI for.