javax.swing.plaf.metal

Class MetalToolBarUI

Implemented Interfaces:
SwingConstants

public class MetalToolBarUI
extends BasicToolBarUI

A Metal Look and Feel implementation of ToolBarUI. This implementation is a "combined" view/controller.

Nested Class Summary

protected class
MetalToolBarUI.MetalContainerListener
protected class
MetalToolBarUI.MetalDockingListener
protected class
MetalToolBarUI.MetalRolloverListener

Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicToolBarUI

BasicToolBarUI.DockingListener, BasicToolBarUI.DragWindow, BasicToolBarUI.FrameListener, BasicToolBarUI.PropertyListener, BasicToolBarUI.ToolBarContListener, BasicToolBarUI.ToolBarFocusListener

Field Summary

protected ContainerListener
contListener
This protected field is implemenation specific.
protected PropertyChangeListener
rolloverListener
This protected field is implemenation specific.

Fields inherited from class javax.swing.plaf.basic.BasicToolBarUI

KeyStrokedownKey, KeyStrokeleftKey, KeyStrokerightKey, KeyStrokeupKey, constraintBeforeFloating, dockingBorderColor, dockingColor, dockingListener, dragWindow, floatingBorderColor, floatingColor, focusedCompIndex, propertyListener, toolBar, toolBarContListener, toolBarFocusListener

Fields inherited from interface javax.swing.SwingConstants

BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST

Method Summary

protected ContainerListener
createContainerListener()
Creates a container listener that will be added to the JToolBar.
protected MouseInputListener
createDockingListener()
protected Border
createNonRolloverBorder()
protected Border
createRolloverBorder()
protected PropertyChangeListener
createRolloverListener()
Creates a property change listener that will be added to the JToolBar.
static ComponentUI
createUI(JComponent c)
Returns an instance of the UI delegate for the specified component.
protected void
installListeners()
void
installUI(JComponent c)
Configures the specified component appropriate for the look and feel.
protected void
setBorderToNonRollover(Component c)
protected void
setDragOffset(Point p)
protected void
uninstallListeners()
void
uninstallUI(JComponent c)
Reverses configuration which was done on the specified component during installUI.
void
update(Graphics g, JComponent c)
If necessary paints the background of the component, then invokes paint.

Methods inherited from class javax.swing.plaf.basic.BasicToolBarUI

canDock, createDockingListener, createDragWindow, createFloatingFrame, createFloatingWindow, createFrameListener, createNonRolloverBorder, createPropertyListener, createRolloverBorder, createToolBarContListener, createToolBarFocusListener, createUI, dragTo, floatAt, getDockingColor, getFloatingColor, installComponents, installDefaults, installKeyboardActions, installListeners, installNonRolloverBorders, installNormalBorders, installRolloverBorders, installUI, isFloating, isRolloverBorders, navigateFocusedComp, paintDragWindow, setBorderToNonRollover, setBorderToNormal, setBorderToRollover, setDockingColor, setFloating, setFloatingColor, setFloatingLocation, setOrientation, setRolloverBorders, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUI

Methods inherited from class javax.swing.plaf.ComponentUI

contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, installUI, paint, uninstallUI, update

Methods inherited from class java.lang.Object

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

Field Details

contListener

protected ContainerListener contListener
This protected field is implemenation specific. Do not access directly or override. Use the create method instead.

rolloverListener

protected PropertyChangeListener rolloverListener
This protected field is implemenation specific. Do not access directly or override. Use the create method instead.

Method Details

createContainerListener

protected ContainerListener createContainerListener()
Creates a container listener that will be added to the JToolBar. If this method returns null then it will not be added to the toolbar.
Returns:
an instance of a ContainerListener or null

createDockingListener

protected MouseInputListener createDockingListener()
Overrides:
createDockingListener in interface BasicToolBarUI

createNonRolloverBorder

protected Border createNonRolloverBorder()
Overrides:
createNonRolloverBorder in interface BasicToolBarUI

createRolloverBorder

protected Border createRolloverBorder()
Overrides:
createRolloverBorder in interface BasicToolBarUI

createRolloverListener

protected PropertyChangeListener createRolloverListener()
Creates a property change listener that will be added to the JToolBar. If this method returns null then it will not be added to the toolbar.
Returns:
an instance of a PropertyChangeListener or null

createUI

public static ComponentUI createUI(JComponent c)
Returns an instance of the UI delegate for the specified component. Each subclass must provide its own static createUI method that returns an instance of that UI delegate subclass. If the UI delegate subclass is stateless, it may return an instance that is shared by multiple components. If the UI delegate is stateful, then it should return a new instance per component. The default implementation of this method throws an error, as it should never be invoked.
Overrides:
createUI in interface BasicToolBarUI

installListeners

protected void installListeners()
Overrides:
installListeners in interface BasicToolBarUI

installUI

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.
Overrides:
installUI in interface BasicToolBarUI
Parameters:
c - the component where this UI delegate is being installed

setBorderToNonRollover

protected void setBorderToNonRollover(Component c)
Overrides:
setBorderToNonRollover in interface BasicToolBarUI

setDragOffset

protected void setDragOffset(Point p)

uninstallListeners

protected void uninstallListeners()
Overrides:
uninstallListeners in interface BasicToolBarUI

uninstallUI

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.
Overrides:
uninstallUI in interface BasicToolBarUI
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

update

public void update(Graphics g,
                   JComponent c)
If necessary paints the background of the component, then invokes paint.
Overrides:
update in interface ComponentUI
Parameters:
g - Graphics to paint to
c - JComponent painting on
Throws:
NullPointerException - if g or c is null
Since:
1.5