Class BasicMenuBarUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.MenuBarUI
javax.swing.plaf.basic.BasicMenuBarUI
- Direct Known Subclasses:
MetalMenuBarUI, SynthMenuBarUI
A default L&F implementation of MenuBarUI. This implementation
is a "combined" view/controller.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ChangeListener
The instance ofChangeListener
.protected ContainerListener
The instance ofContainerListener
.protected JMenuBar
The instance ofJMenuBar
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ChangeListener
Returns an instance ofChangeListener
.protected ContainerListener
Returns an instance ofContainerListener
.static ComponentUI
Returns a new instance ofBasicMenuBarUI
.Returns the specified component's maximum size appropriate for the look and feel.Returns the specified component's minimum size appropriate for the look and feel.protected void
Installs default properties.protected void
Registers keyboard actions.protected void
Registers listeners.void
Configures the specified component appropriately for the look and feel.protected void
Uninstalls default properties.protected void
Unregisters keyboard actions.protected void
Unregisters listeners.void
Reverses configuration which was done on the specified component duringinstallUI
.Methods inherited from class ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getPreferredSize, paint, update
-
Field Details
-
containerListener
The instance ofContainerListener
. -
changeListener
The instance ofChangeListener
.
-
Constructor Details
-
BasicMenuBarUI
public BasicMenuBarUI()Constructs aBasicMenuBarUI
.
-
-
Method Details
-
createUI
Returns a new instance ofBasicMenuBarUI
.- Parameters:
x
- a component- Returns:
- a new instance of
BasicMenuBarUI
-
installUI
Description copied from class:ComponentUI
Configures the specified component appropriately for the look and feel. This method is invoked when theComponentUI
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:- 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.
- Install a
LayoutManager
on the component if necessary. - Create/add any required sub-components to the component.
- Create/install event listeners on the component.
- Create/install a
PropertyChangeListener
on the component in order to detect and respond to component property changes appropriately. - Install keyboard UI (mnemonics, traversal, etc.) on the component.
- Initialize any appropriate instance data.
- Overrides:
installUI
in classComponentUI
- Parameters:
c
- the component where this UI delegate is being installed- See Also:
-
installDefaults
protected void installDefaults()Installs default properties. -
installListeners
protected void installListeners()Registers listeners. -
installKeyboardActions
protected void installKeyboardActions()Registers keyboard actions. -
uninstallUI
Description copied from class:ComponentUI
Reverses configuration which was done on the specified component duringinstallUI
. This method is invoked when thisUIComponent
instance is being removed as the UI delegate for the specified component. This method should undo the configuration performed ininstallUI
, being careful to leave theJComponent
instance in a clean state (no extraneous listeners, look-and-feel-specific property objects, etc.). This should include the following:- Remove any UI-set borders from the component.
- Remove any UI-set layout managers on the component.
- Remove any UI-added sub-components from the component.
- Remove any UI-added event/property listeners from the component.
- Remove any UI-installed keyboard UI from the component.
- Nullify any allocated instance data objects to allow for GC.
- Overrides:
uninstallUI
in classComponentUI
- 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- See Also:
-
uninstallDefaults
protected void uninstallDefaults()Uninstalls default properties. -
uninstallListeners
protected void uninstallListeners()Unregisters listeners. -
uninstallKeyboardActions
protected void uninstallKeyboardActions()Unregisters keyboard actions. -
createContainerListener
Returns an instance ofContainerListener
.- Returns:
- an instance of
ContainerListener
-
createChangeListener
Returns an instance ofChangeListener
.- Returns:
- an instance of
ChangeListener
-
getMinimumSize
Description copied from class:ComponentUI
Returns the specified component's minimum size appropriate for the look and feel. Ifnull
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 invokesgetPreferredSize
and returns that value.- Overrides:
getMinimumSize
in classComponentUI
- Parameters:
c
- the component whose minimum size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components- Returns:
- a
Dimension
object ornull
- See Also:
-
getMaximumSize
Description copied from class:ComponentUI
Returns the specified component's maximum size appropriate for the look and feel. Ifnull
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 invokesgetPreferredSize
and returns that value.- Overrides:
getMaximumSize
in classComponentUI
- Parameters:
c
- the component whose maximum size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components- Returns:
- a
Dimension
object ornull
- See Also:
-