javax.swing.plaf.basic

Class BasicMenuBarUI

public class BasicMenuBarUI extends MenuBarUI

UI Delegate for JMenuBar.
Field Summary
protected ChangeListenerchangeListener
protected ContainerListenercontainerListener
protected JMenuBarmenuBar
Constructor Summary
BasicMenuBarUI()
Creates a new BasicMenuBarUI object.
Method Summary
protected ChangeListenercreateChangeListener()
Creates ChangeListener
protected ContainerListenercreateContainerListener()
Creates ContainerListener() to listen for ContainerEvents fired by JMenuBar.
static ComponentUIcreateUI(JComponent x)
Factory method to create a BasicMenuBarUI for the given {@link JComponent}, which should be a {@link JMenuBar}.
DimensiongetMaximumSize(JComponent c)
Returns maximum size for the specified menu bar
DimensiongetMinimumSize(JComponent c)
Returns maximum allowed size of JMenuBar.
DimensiongetPreferredSize(JComponent c)
Returns preferred size of JMenuBar.
protected voidinstallDefaults()
Initializes any default properties that this UI has from the defaults for the Basic look and feel.
protected voidinstallKeyboardActions()
This method installs the keyboard actions for the JMenuBar.
protected voidinstallListeners()
This method installs the listeners needed for this UI to function.
voidinstallUI(JComponent c)
Installs and initializes all fields for this UI delegate.
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()
Unregisters all the listeners that this UI delegate was using.
voiduninstallUI(JComponent c)
Performs the opposite of installUI.

Field Detail

changeListener

protected ChangeListener changeListener

containerListener

protected ContainerListener containerListener

menuBar

protected JMenuBar menuBar

Constructor Detail

BasicMenuBarUI

public BasicMenuBarUI()
Creates a new BasicMenuBarUI object.

Method Detail

createChangeListener

protected ChangeListener createChangeListener()
Creates ChangeListener

Returns: The ChangeListener

createContainerListener

protected ContainerListener createContainerListener()
Creates ContainerListener() to listen for ContainerEvents fired by JMenuBar.

Returns: The ContainerListener

createUI

public static ComponentUI createUI(JComponent x)
Factory method to create a BasicMenuBarUI for the given {@link JComponent}, which should be a {@link JMenuBar}.

Parameters: x The {@link JComponent} a UI is being created for.

Returns: A BasicMenuBarUI for the {@link JComponent}.

getMaximumSize

public Dimension getMaximumSize(JComponent c)
Returns maximum size for the specified menu bar

Parameters: c component for which to get maximum size

Returns: Maximum size for the specified menu bar

getMinimumSize

public Dimension getMinimumSize(JComponent c)
Returns maximum allowed size of JMenuBar.

Parameters: c menuBar for which to return maximum size

Returns: Maximum size of the give menu bar.

getPreferredSize

public Dimension getPreferredSize(JComponent c)
Returns preferred size of JMenuBar.

Parameters: c menuBar for which to return preferred size

Returns: Preferred size of the give menu bar.

installDefaults

protected void installDefaults()
Initializes any default properties that this UI has from the defaults for the Basic look and feel.

installKeyboardActions

protected void installKeyboardActions()
This method installs the keyboard actions for the JMenuBar.

installListeners

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

installUI

public void installUI(JComponent c)
Installs and initializes all fields for this UI delegate. Any properties of the UI that need to be initialized and/or set to defaults will be done now. It will also install any listeners necessary.

Parameters: c The {@link JComponent} that is having this UI installed.

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()
Unregisters all the listeners that this UI delegate was using.

uninstallUI

public void uninstallUI(JComponent c)
Performs the opposite of installUI. Any properties or resources that need to be cleaned up will be done now. It will also uninstall any listeners it has. In addition, any properties of this UI will be nulled.

Parameters: c The {@link JComponent} that is having this UI uninstalled.