javax.swing.plaf.basic
Class BasicMenuBarUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.MenuBarUI
          extended by javax.swing.plaf.basic.BasicMenuBarUI
Direct Known Subclasses:
MetalMenuBarUI

public class BasicMenuBarUI
extends MenuBarUI

UI Delegate for JMenuBar.


Field Summary
protected  ChangeListener changeListener
           
protected  ContainerListener containerListener
           
protected  JMenuBar menuBar
           
 
Constructor Summary
BasicMenuBarUI()
          Creates a new BasicMenuBarUI object.
 
Method Summary
protected  ChangeListener createChangeListener()
          Creates ChangeListener
protected  ContainerListener createContainerListener()
          Creates ContainerListener() to listen for ContainerEvents fired by JMenuBar.
static ComponentUI createUI(JComponent x)
          Factory method to create a BasicMenuBarUI for the given JComponent, which should be a JMenuBar.
 Dimension getMaximumSize(JComponent c)
          Returns maximum size for the specified menu bar
 Dimension getMinimumSize(JComponent c)
          Returns maximum allowed size of JMenuBar.
 Dimension getPreferredSize(JComponent c)
          Returns preferred size of JMenuBar.
protected  void installDefaults()
          Initializes any default properties that this UI has from the defaults for the Basic look and feel.
protected  void installKeyboardActions()
          This method installs the keyboard actions for the JMenuBar.
protected  void installListeners()
          This method installs the listeners needed for this UI to function.
 void installUI(JComponent c)
          Installs and initializes all fields for this UI delegate.
protected  void uninstallDefaults()
          This method uninstalls the defaults and nulls any objects created during install.
protected  void uninstallKeyboardActions()
          This method reverses the work done in installKeyboardActions.
protected  void uninstallListeners()
          Unregisters all the listeners that this UI delegate was using.
 void uninstallUI(JComponent c)
          Performs the opposite of installUI.
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, paint, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 JComponent, which should be a JMenuBar.

Parameters:
x - The JComponent a UI is being created for.
Returns:
A BasicMenuBarUI for the JComponent.

getMaximumSize

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

Overrides:
getMaximumSize in class ComponentUI
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.

Overrides:
getMinimumSize in class ComponentUI
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.

Overrides:
getPreferredSize in class ComponentUI
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.

Overrides:
installUI in class ComponentUI
Parameters:
c - The JComponent that is having this UI installed.
See Also:
ComponentUI.uninstallUI(javax.swing.JComponent), JComponent.setUI(javax.swing.plaf.ComponentUI), JComponent.updateUI()

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.

Overrides:
uninstallUI in class ComponentUI
Parameters:
c - The JComponent that is having this UI uninstalled.
See Also:
ComponentUI.installUI(javax.swing.JComponent), JComponent.setUI(javax.swing.plaf.ComponentUI), JComponent.updateUI()