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

public Class SynthMenuItemUI

extends BasicMenuItemUI
implements PropertyChangeListener, SynthUI
Class Inheritance
All Implemented Interfaces
javax.swing.plaf.synth.SynthUI, javax.swing.plaf.synth.SynthConstants, java.beans.PropertyChangeListener, java.util.EventListener
Known Direct Subclasses
javax.swing.plaf.synth.SynthRadioButtonMenuItemUI, javax.swing.plaf.synth.SynthCheckBoxMenuItemUI
Imports
java.awt.*, java.beans.PropertyChangeEvent, .PropertyChangeListener, javax.swing.*, javax.swing.plaf.*, javax.swing.plaf.basic.*, sun.swing.MenuItemLayoutHelper

Provides the Synth L&F UI delegate for javax.swing.JMenuItem.
Authors
Georges Saab, David Karlton, Arnaud Weber, Fredrik Lagerblad
Since
1.7

Field Summary

Modifier and TypeField and Description
private SynthStyle
private SynthStyle
Inherited from javax.swing.plaf.basic.BasicMenuItemUI:
acceleratorDelimiteracceleratorFontacceleratorForegroundacceleratorSelectionForegroundarrowIconcheckIcondefaultTextIconGapdisabledForegroundmenuDragMouseListenermenuItemmenuKeyListenermouseInputListeneroldBorderPaintedpropertyChangeListenerselectionBackgroundselectionForeground

Constructor Summary

AccessConstructor and Description
public
SynthMenuItemUI()

Constructs a SynthMenuItemUI.

Method Summary

Modifier and TypeMethod and Description
public static ComponentUI

Returns:

the UI object
createUI
(JComponent
component to create UI object for
c
)

Hides javax.swing.plaf.basic.BasicMenuItemUI.createUI.

Creates a new UI object for the given component.

private int
private int
public SynthContext
getContext(JComponent c)

Implements javax.swing.plaf.synth.SynthUI.getContext.

Returns the Context for the specified component.

pack-priv SynthContext
getContext(JComponent c, int state)

pack-priv SynthContext
private SynthContext
getContext(JComponent c, Region region, int state)

protected Dimension
getPreferredMenuItemSize(JComponent c, Icon checkIcon, Icon arrowIcon, int defaultTextIconGap)

Overrides javax.swing.plaf.basic.BasicMenuItemUI.getPreferredMenuItemSize.

Returns the preferred size of a menu item.

protected void
protected void
public void
paint(Graphics
the Graphics object used for painting
g
,
JComponent
the component being painted
c
)

Overrides javax.swing.plaf.basic.BasicMenuItemUI.paint.

Paints the specified component according to the Look and Feel.

protected void
paint(SynthContext
context for the component being painted
context
,
Graphics
the Graphics object used for painting
g
)

Paints the specified component.

pack-priv void
public void
paintBorder(SynthContext context, Graphics g, int x, int y, int w, int h)

Implements javax.swing.plaf.synth.SynthUI.paintBorder.

Paints the border.

public void
propertyChange(PropertyChangeEvent e)

Implements java.beans.PropertyChangeListener.propertyChange.

This method gets called when a bound property is changed.

protected void
protected void
public void
uninstallUI(JComponent c)

Overrides javax.swing.plaf.basic.BasicMenuItemUI.uninstallUI.

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

public void
update(Graphics
the Graphics object used for painting
g
,
JComponent
the component being painted
c
)

Overrides javax.swing.plaf.basic.BasicMenuItemUI.update.

Notifies this UI delegate to repaint the specified component.

private void
Inherited from javax.swing.plaf.basic.BasicMenuItemUI:
createMenuDragMouseListenercreateMenuKeyListenercreateMouseInputListenercreatePropertyChangeListenerdoClickgetMaximumSizegetMinimumSizegetPathgetPreferredSizegetPropertyPrefixinstallComponentsinstallKeyboardActionsinstallUIpaintBackgroundpaintMenuItempaintTextuninstallComponentsuninstallKeyboardActions

Field Detail

accStyleback to summary
private SynthStyle accStyle
styleback to summary
private SynthStyle style

Constructor Detail

SynthMenuItemUIback to summary
public SynthMenuItemUI()

Constructs a SynthMenuItemUI.

Method Detail

createUIback to summary
public static ComponentUI createUI(JComponent c)

Hides javax.swing.plaf.basic.BasicMenuItemUI.createUI.

Creates a new UI object for the given component.

Parameters
c:JComponent

component to create UI object for

Returns:ComponentUI

the UI object

getComponentStateback to summary
private int getComponentState(JComponent c)
getComponentStateback to summary
private int getComponentState(JComponent c, Region region)
getContextback to summary
public SynthContext getContext(JComponent c)

Implements javax.swing.plaf.synth.SynthUI.getContext.

Doc from javax.swing.plaf.synth.SynthUI.getContext.

Returns the Context for the specified component.

Annotations
@Override
getContextback to summary
pack-priv SynthContext getContext(JComponent c, int state)
getContextback to summary
pack-priv SynthContext getContext(JComponent c, Region region)
getContextback to summary
private SynthContext getContext(JComponent c, Region region, int state)
getPreferredMenuItemSizeback to summary
protected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon, Icon arrowIcon, int defaultTextIconGap)

Overrides javax.swing.plaf.basic.BasicMenuItemUI.getPreferredMenuItemSize.

Doc from javax.swing.plaf.basic.BasicMenuItemUI.getPreferredMenuItemSize.

Returns the preferred size of a menu item.

Annotations
@Override
installDefaultsback to summary
protected void installDefaults()

Overrides javax.swing.plaf.basic.BasicMenuItemUI.installDefaults.

Doc from javax.swing.plaf.basic.BasicMenuItemUI.installDefaults.

Installs default properties.

Annotations
@Override
installListenersback to summary
protected void installListeners()

Overrides javax.swing.plaf.basic.BasicMenuItemUI.installListeners.

Doc from javax.swing.plaf.basic.BasicMenuItemUI.installListeners.

Registers listeners.

Annotations
@Override
paintback to summary
public void paint(Graphics g, JComponent c)

Overrides javax.swing.plaf.basic.BasicMenuItemUI.paint.

Paints the specified component according to the Look and Feel.

This method is not used by Synth Look and Feel. Painting is handled by the paint(SynthContext, Graphics) method.

Parameters
g:Graphics

the Graphics object used for painting

c:JComponent

the component being painted

Annotations
@Override
See Also
paint(SynthContext, Graphics)
paintback to summary
protected void paint(SynthContext context, Graphics g)

Paints the specified component.

Parameters
context:SynthContext

context for the component being painted

g:Graphics

the Graphics object used for painting

See Also
update(Graphics, JComponent)
paintBackgroundback to summary
pack-priv void paintBackground(SynthContext context, Graphics g, JComponent c)
paintBorderback to summary
public void paintBorder(SynthContext context, Graphics g, int x, int y, int w, int h)

Implements javax.swing.plaf.synth.SynthUI.paintBorder.

Doc from javax.swing.plaf.synth.SynthUI.paintBorder.

Paints the border.

Annotations
@Override
propertyChangeback to summary
public void propertyChange(PropertyChangeEvent e)

Implements java.beans.PropertyChangeListener.propertyChange.

Doc from java.beans.PropertyChangeListener.propertyChange.

This method gets called when a bound property is changed.

Annotations
@Override
uninstallDefaultsback to summary
protected void uninstallDefaults()

Overrides javax.swing.plaf.basic.BasicMenuItemUI.uninstallDefaults.

Doc from javax.swing.plaf.basic.BasicMenuItemUI.uninstallDefaults.

Uninstalls default properties.

Annotations
@Override
uninstallListenersback to summary
protected void uninstallListeners()

Overrides javax.swing.plaf.basic.BasicMenuItemUI.uninstallListeners.

Doc from javax.swing.plaf.basic.BasicMenuItemUI.uninstallListeners.

Unregisters listeners.

Annotations
@Override
uninstallUIback to summary
public void uninstallUI(JComponent c)

Overrides javax.swing.plaf.basic.BasicMenuItemUI.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.
Annotations
@Override
updateback to summary
public void update(Graphics g, JComponent c)

Overrides javax.swing.plaf.basic.BasicMenuItemUI.update.

Notifies this UI delegate to repaint the specified component. This method paints the component background, then calls the paint(SynthContext, Graphics) method.

In general, this method does not need to be overridden by subclasses. All Look and Feel rendering code should reside in the paint method.

Parameters
g:Graphics

the Graphics object used for painting

c:JComponent

the component being painted

Annotations
@Override
See Also
paint(SynthContext, Graphics)
updateStyleback to summary
private void updateStyle(JMenuItem mi)