APIdia Launch Partner
Top Description Inners Fields Constructors Methods
javax.swing.plaf.basic

public Class BasicMenuBarUI

extends MenuBarUI
Class Inheritance
Known Direct Subclasses
javax.swing.plaf.metal.MetalMenuBarUI, javax.swing.plaf.synth.SynthMenuBarUI, com.sun.java.swing.plaf.motif.MotifMenuBarUI
Imports
sun.swing.DefaultLookup, .UIAction, javax.swing.*, javax.swing.event.*, java.awt.Color, .Component, .Container, .Dimension, .Graphics, .Insets, .Point, .Rectangle, java.awt.event.*, java.beans.PropertyChangeEvent, .PropertyChangeListener, javax.swing.border.*, javax.swing.plaf.*

A default L&F implementation of MenuBarUI. This implementation is a "combined" view/controller.
Authors
Georges Saab, David Karlton, Arnaud Weber

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private class

Field Summary

Modifier and TypeField and Description
protected ChangeListener
changeListener

The instance of ChangeListener.

protected ContainerListener
containerListener

The instance of ContainerListener.

private BasicMenuBarUI.Handler

Constructor Summary

AccessConstructor and Description
public
BasicMenuBarUI()

Constructs a BasicMenuBarUI.

Method Summary

Modifier and TypeMethod and Description
protected ChangeListener

Returns:

an instance of ChangeListener
createChangeListener
()

Returns an instance of ChangeListener.

protected ContainerListener

Returns:

an instance of ContainerListener
createContainerListener
()

Returns an instance of ContainerListener.

public static ComponentUI

Returns:

a new instance of BasicMenuBarUI
createUI
(JComponent
a component
x
)

Hides javax.swing.plaf.ComponentUI.createUI.

Returns a new instance of BasicMenuBarUI.

private BasicMenuBarUI.Handler
pack-priv InputMap
getInputMap(int condition)

public Dimension
getMaximumSize(JComponent c)

Overrides javax.swing.plaf.ComponentUI.getMaximumSize.

Returns the specified component's maximum size appropriate for the look and feel.

public Dimension
getMinimumSize(JComponent c)

Overrides javax.swing.plaf.ComponentUI.getMinimumSize.

Returns the specified component's minimum size appropriate for the look and feel.

protected void
installDefaults()

Installs default properties.

protected void
installKeyboardActions()

Registers keyboard actions.

protected void
installListeners()

Registers listeners.

public void
installUI(JComponent c)

Overrides javax.swing.plaf.ComponentUI.installUI.

Configures the specified component appropriately for the look and feel.

pack-priv static void
protected void
uninstallDefaults()

Uninstalls default properties.

protected void
uninstallKeyboardActions()

Unregisters keyboard actions.

protected void
uninstallListeners()

Unregisters listeners.

public void
uninstallUI(JComponent c)

Overrides javax.swing.plaf.ComponentUI.uninstallUI.

Reverses configuration which was done on the specified component during installUI.

Field Detail

changeListenerback to summary
protected ChangeListener changeListener

The instance of ChangeListener.

containerListenerback to summary
protected ContainerListener containerListener

The instance of ContainerListener.

handlerback to summary
private BasicMenuBarUI.Handler handler

Constructor Detail

BasicMenuBarUIback to summary
public BasicMenuBarUI()

Constructs a BasicMenuBarUI.

Method Detail

createChangeListenerback to summary
protected ChangeListener createChangeListener()

Returns an instance of ChangeListener.

Returns:ChangeListener

an instance of ChangeListener

createContainerListenerback to summary
protected ContainerListener createContainerListener()

Returns an instance of ContainerListener.

Returns:ContainerListener

an instance of ContainerListener

createUIback to summary
public static ComponentUI createUI(JComponent x)

Hides javax.swing.plaf.ComponentUI.createUI.

Returns a new instance of BasicMenuBarUI.

Parameters
x:JComponent

a component

Returns:ComponentUI

a new instance of BasicMenuBarUI

getHandlerback to summary
private BasicMenuBarUI.Handler getHandler()
getInputMapback to summary
pack-priv InputMap getInputMap(int condition)
getMaximumSizeback to summary
public Dimension getMaximumSize(JComponent c)

Overrides javax.swing.plaf.ComponentUI.getMaximumSize.

Doc from javax.swing.plaf.ComponentUI.getMaximumSize.

Returns the specified component's maximum size appropriate for the look and feel. If null is returned, the maximum size will be calculated by the component's layout manager instead (this is the preferred approach for any component with a specific layout manager installed). The default implementation of this method invokes getPreferredSize and returns that value.

getMinimumSizeback to summary
public Dimension getMinimumSize(JComponent c)

Overrides javax.swing.plaf.ComponentUI.getMinimumSize.

Doc from javax.swing.plaf.ComponentUI.getMinimumSize.

Returns the specified component's minimum size appropriate for the look and feel. If null is returned, the minimum size will be calculated by the component's layout manager instead (this is the preferred approach for any component with a specific layout manager installed). The default implementation of this method invokes getPreferredSize and returns that value.

installDefaultsback to summary
protected void installDefaults()

Installs default properties.

installKeyboardActionsback to summary
protected void installKeyboardActions()

Registers keyboard actions.

installListenersback to summary
protected void installListeners()

Registers listeners.

installUIback to summary
public void installUI(JComponent c)

Overrides javax.swing.plaf.ComponentUI.installUI.

Doc from javax.swing.plaf.ComponentUI.installUI.

Configures the specified component appropriately 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 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.
loadActionMapback to summary
pack-priv static void loadActionMap(LazyActionMap map)
uninstallDefaultsback to summary
protected void uninstallDefaults()

Uninstalls default properties.

uninstallKeyboardActionsback to summary
protected void uninstallKeyboardActions()

Unregisters keyboard actions.

uninstallListenersback to summary
protected void uninstallListeners()

Unregisters listeners.

uninstallUIback to summary
public void uninstallUI(JComponent c)

Overrides javax.swing.plaf.ComponentUI.uninstallUI.

Doc from javax.swing.plaf.ComponentUI.uninstallUI.

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.
javax.swing.plaf.basic back to summary

private Class BasicMenuBarUI.Actions

extends UIAction
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
actionPerformed(ActionEvent e)

Implements java.awt.event.ActionListener.actionPerformed.

Invoked when an action occurs.

Inherited from sun.swing.UIAction:
acceptaddPropertyChangeListenergetNamegetValueisEnabledputValueremovePropertyChangeListenersetEnabled

Field Detail

TAKE_FOCUSback to summary
private static final String TAKE_FOCUS

Constructor Detail

Actionsback to summary
pack-priv Actions(String key)

Method Detail

actionPerformedback to summary
public void actionPerformed(ActionEvent e)

Implements java.awt.event.ActionListener.actionPerformed.

Doc from java.awt.event.ActionListener.actionPerformed.

Invoked when an action occurs.

javax.swing.plaf.basic back to summary

private Class BasicMenuBarUI.Handler

extends Object
implements ChangeListener, ContainerListener
Class Inheritance
All Implemented Interfaces
java.awt.event.ContainerListener, java.util.EventListener, javax.swing.event.ChangeListener

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
componentAdded(ContainerEvent e)

Implements java.awt.event.ContainerListener.componentAdded.

Invoked when a component has been added to the container.

public void
componentRemoved(ContainerEvent e)

Implements java.awt.event.ContainerListener.componentRemoved.

Invoked when a component has been removed from the container.

public void
stateChanged(ChangeEvent e)

Implements javax.swing.event.ChangeListener.stateChanged.

Invoked when the target of the listener has changed its state.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Handlerback to summary
private Handler()

Method Detail

componentAddedback to summary
public void componentAdded(ContainerEvent e)

Implements java.awt.event.ContainerListener.componentAdded.

Doc from java.awt.event.ContainerListener.componentAdded.

Invoked when a component has been added to the container.

componentRemovedback to summary
public void componentRemoved(ContainerEvent e)

Implements java.awt.event.ContainerListener.componentRemoved.

Doc from java.awt.event.ContainerListener.componentRemoved.

Invoked when a component has been removed from the container.

stateChangedback to summary
public void stateChanged(ChangeEvent e)

Implements javax.swing.event.ChangeListener.stateChanged.

Doc from javax.swing.event.ChangeListener.stateChanged.

Invoked when the target of the listener has changed its state.