Use Tree Navigation
public class

BasicToolBarUI

extends ToolBarUI
implements SwingConstants
java.lang.Object
   â†³ javax.swing.plaf.ComponentUI
     â†³ javax.swing.plaf.ToolBarUI
       â†³ javax.swing.plaf.basic.BasicToolBarUI
Known Direct Subclasses

Class Overview

A Basic L&F implementation of ToolBarUI. This implementation is a "combined" view/controller.

Summary

Nested Classes
class BasicToolBarUI.DockingListener This class should be treated as a "protected" inner class. 
class BasicToolBarUI.DragWindow  
class BasicToolBarUI.FrameListener  
class BasicToolBarUI.PropertyListener  
class BasicToolBarUI.ToolBarContListener  
class BasicToolBarUI.ToolBarFocusListener  
[Expand]
Inherited Constants
From interface javax.swing.SwingConstants
Fields
protected String constraintBeforeFloating
protected Color dockingBorderColor
protected Color dockingColor
protected MouseInputListener dockingListener
protected KeyStroke downKey This field is deprecated. As of Java 2 platform v1.3.
protected BasicToolBarUI.DragWindow dragWindow
protected Color floatingBorderColor
protected Color floatingColor
protected int focusedCompIndex
protected KeyStroke leftKey This field is deprecated. As of Java 2 platform v1.3.
protected PropertyChangeListener propertyListener
protected KeyStroke rightKey This field is deprecated. As of Java 2 platform v1.3.
protected JToolBar toolBar
protected ContainerListener toolBarContListener
protected FocusListener toolBarFocusListener
protected KeyStroke upKey This field is deprecated. As of Java 2 platform v1.3.
Public Constructors
BasicToolBarUI()
Public Methods
boolean canDock(Component c, Point p)
static ComponentUI createUI(JComponent c)
Color getDockingColor()
Gets the color displayed when over a docking area
Color getFloatingColor()
Gets the color displayed when over a floating area
void installUI(JComponent c)
Configures the specified component appropriate for the look and feel.
boolean isFloating()
boolean isRolloverBorders()
Returns a flag to determine whether rollover button borders are enabled.
void setDockingColor(Color c)
Sets the color displayed when over a docking area
void setFloating(boolean b, Point p)
void setFloatingColor(Color c)
Sets the color displayed when over a floating area
void setFloatingLocation(int x, int y)
void setOrientation(int orientation)
void setRolloverBorders(boolean rollover)
Sets the flag for enabling rollover borders on the toolbar and it will also install the apropriate border depending on the state of the flag.
void uninstallUI(JComponent c)
Reverses configuration which was done on the specified component during installUI.
Protected Methods
MouseInputListener createDockingListener()
BasicToolBarUI.DragWindow createDragWindow(JToolBar toolbar)
JFrame createFloatingFrame(JToolBar toolbar)
No longer used, use BasicToolBarUI.createFloatingWindow(JToolBar)
RootPaneContainer createFloatingWindow(JToolBar toolbar)
Creates a window which contains the toolbar after it has been dragged out from its container
WindowListener createFrameListener()
Border createNonRolloverBorder()
Creates the non rollover border for toolbar components.
PropertyChangeListener createPropertyListener()
Border createRolloverBorder()
Creates a rollover border for toolbar components.
ContainerListener createToolBarContListener()
FocusListener createToolBarFocusListener()
void dragTo(Point position, Point origin)
void floatAt(Point position, Point origin)
Border getNonRolloverBorder(AbstractButton b)
Returns a non-rollover border for the button.
Border getRolloverBorder(AbstractButton b)
Returns a rollover border for the button.
void installComponents()
void installDefaults()
void installKeyboardActions()
void installListeners()
void installNonRolloverBorders(JComponent c)
Installs non-rollover borders on all the child components of the JComponent.
void installNormalBorders(JComponent c)
Installs normal borders on all the child components of the JComponent.
void installRolloverBorders(JComponent c)
Installs rollover borders on all the child components of the JComponent.
void navigateFocusedComp(int direction)
void paintDragWindow(Graphics g)
Paints the contents of the window used for dragging.
void setBorderToNonRollover(Component c)
Sets the border of the component to have a non-rollover border which was created by createNonRolloverBorder.
void setBorderToNormal(Component c)
Sets the border of the component to have a normal border.
void setBorderToRollover(Component c)
Sets the border of the component to have a rollover border which was created by createRolloverBorder.
void uninstallComponents()
void uninstallDefaults()
void uninstallKeyboardActions()
void uninstallListeners()
[Expand]
Inherited Methods
From class javax.swing.plaf.ComponentUI
From class java.lang.Object

Fields

protected String constraintBeforeFloating

protected Color dockingBorderColor

protected Color dockingColor

protected MouseInputListener dockingListener

protected KeyStroke downKey

This field is deprecated.
As of Java 2 platform v1.3.

As of Java 2 platform v1.3 this previously undocumented field is no longer used. Key bindings are now defined by the LookAndFeel, please refer to the key bindings specification for further details.

protected BasicToolBarUI.DragWindow dragWindow

protected Color floatingBorderColor

protected Color floatingColor

protected int focusedCompIndex

protected KeyStroke leftKey

This field is deprecated.
As of Java 2 platform v1.3.

As of Java 2 platform v1.3 this previously undocumented field is no longer used. Key bindings are now defined by the LookAndFeel, please refer to the key bindings specification for further details.

protected PropertyChangeListener propertyListener

protected KeyStroke rightKey

This field is deprecated.
As of Java 2 platform v1.3.

As of Java 2 platform v1.3 this previously undocumented field is no longer used. Key bindings are now defined by the LookAndFeel, please refer to the key bindings specification for further details.

protected JToolBar toolBar

protected ContainerListener toolBarContListener

protected FocusListener toolBarFocusListener

protected KeyStroke upKey

This field is deprecated.
As of Java 2 platform v1.3.

As of Java 2 platform v1.3 this previously undocumented field is no longer used. Key bindings are now defined by the LookAndFeel, please refer to the key bindings specification for further details.

Public Constructors

public BasicToolBarUI ()

Public Methods

public boolean canDock (Component c, Point p)

public static ComponentUI createUI (JComponent c)

public Color getDockingColor ()

Gets the color displayed when over a docking area

public Color getFloatingColor ()

Gets the color displayed when over a floating area

public void installUI (JComponent c)

Configures the specified component appropriate for the look and feel. This method is invoked when the ComponentUI instance is being installed as the UI delegate on the specified component. This method should completely configure the component for the look and feel, including the following:

  1. Install any default property values for color, fonts, borders, icons, opacity, etc. on the component. Whenever possible, property values initialized by the client program should not be overridden.
  2. Install a LayoutManager on the component if necessary.
  3. Create/add any required sub-components to the component.
  4. Create/install event listeners on the component.
  5. Create/install a PropertyChangeListener on the component in order to detect and respond to component property changes appropriately.
  6. Install keyboard UI (mnemonics, traversal, etc.) on the component.
  7. Initialize any appropriate instance data.

Parameters
c the component where this UI delegate is being installed

public boolean isFloating ()

public boolean isRolloverBorders ()

Returns a flag to determine whether rollover button borders are enabled.

Returns
  • true if rollover borders are enabled; false otherwise

public void setDockingColor (Color c)

Sets the color displayed when over a docking area

public void setFloating (boolean b, Point p)

public void setFloatingColor (Color c)

Sets the color displayed when over a floating area

public void setFloatingLocation (int x, int y)

public void setOrientation (int orientation)

public void setRolloverBorders (boolean rollover)

Sets the flag for enabling rollover borders on the toolbar and it will also install the apropriate border depending on the state of the flag.

Parameters
rollover if true, rollover borders are installed. Otherwise non-rollover borders are installed

public void uninstallUI (JComponent c)

Reverses configuration which was done on the specified component during installUI. This method is invoked when this UIComponent instance is being removed as the UI delegate for the specified component. This method should undo the configuration performed in installUI, being careful to leave the JComponent instance in a clean state (no extraneous listeners, look-and-feel-specific property objects, etc.). This should include the following:

  1. Remove any UI-set borders from the component.
  2. Remove any UI-set layout managers on the component.
  3. Remove any UI-added sub-components from the component.
  4. Remove any UI-added event/property listeners from the component.
  5. Remove any UI-installed keyboard UI from the component.
  6. Nullify any allocated instance data objects to allow for GC.

Parameters
c the component from which this UI delegate is being removed; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components

Protected Methods

protected MouseInputListener createDockingListener ()

protected BasicToolBarUI.DragWindow createDragWindow (JToolBar toolbar)

protected JFrame createFloatingFrame (JToolBar toolbar)

No longer used, use BasicToolBarUI.createFloatingWindow(JToolBar)

protected RootPaneContainer createFloatingWindow (JToolBar toolbar)

Creates a window which contains the toolbar after it has been dragged out from its container

Returns
  • a RootPaneContainer object, containing the toolbar.

protected WindowListener createFrameListener ()

protected Border createNonRolloverBorder ()

Creates the non rollover border for toolbar components. This border will be installed as the border for components added to the toolbar if rollover borders are not enabled.

Override this method to provide an alternate rollover border.

protected PropertyChangeListener createPropertyListener ()

protected Border createRolloverBorder ()

Creates a rollover border for toolbar components. The rollover border will be installed if rollover borders are enabled.

Override this method to provide an alternate rollover border.

protected ContainerListener createToolBarContListener ()

protected FocusListener createToolBarFocusListener ()

protected void dragTo (Point position, Point origin)

protected void floatAt (Point position, Point origin)

protected Border getNonRolloverBorder (AbstractButton b)

Returns a non-rollover border for the button.

Parameters
b the button to calculate the non-rollover border for
Returns
  • the non-rollover border

protected Border getRolloverBorder (AbstractButton b)

Returns a rollover border for the button.

Parameters
b the button to calculate the rollover border for
Returns
  • the rollover border

protected void installComponents ()

protected void installDefaults ()

protected void installKeyboardActions ()

protected void installListeners ()

protected void installNonRolloverBorders (JComponent c)

Installs non-rollover borders on all the child components of the JComponent. A non-rollover border is the border that is installed on the child component while it is in the toolbar.

This is a convenience method to call setBorderToNonRollover for each child component.

Parameters
c container which holds the child components (usally a JToolBar)

protected void installNormalBorders (JComponent c)

Installs normal borders on all the child components of the JComponent. A normal border is the original border that was installed on the child component before it was added to the toolbar.

This is a convenience method to call setBorderNormal for each child component.

Parameters
c container which holds the child components (usally a JToolBar)

protected void installRolloverBorders (JComponent c)

Installs rollover borders on all the child components of the JComponent.

This is a convenience method to call setBorderToRollover for each child component.

Parameters
c container which holds the child components (usally a JToolBar)

protected void navigateFocusedComp (int direction)

protected void paintDragWindow (Graphics g)

Paints the contents of the window used for dragging.

Parameters
g Graphics to paint to.
Throws
NullPointerException is g is null

protected void setBorderToNonRollover (Component c)

Sets the border of the component to have a non-rollover border which was created by createNonRolloverBorder.

Parameters
c component which will have a non-rollover border installed

protected void setBorderToNormal (Component c)

Sets the border of the component to have a normal border. A normal border is the original border that was installed on the child component before it was added to the toolbar.

Parameters
c component which will have a normal border re-installed

protected void setBorderToRollover (Component c)

Sets the border of the component to have a rollover border which was created by createRolloverBorder.

Parameters
c component which will have a rollover border installed

protected void uninstallComponents ()

protected void uninstallDefaults ()

protected void uninstallKeyboardActions ()

protected void uninstallListeners ()