java.lang.Object | ||||
↳ | javax.swing.plaf.ComponentUI | |||
↳ | javax.swing.plaf.ButtonUI | |||
↳ | javax.swing.plaf.MenuItemUI | |||
↳ | javax.swing.plaf.basic.BasicMenuItemUI |
![]() |
![]() |
BasicMenuItem implementation
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
BasicMenuItemUI.MouseInputHandler |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
acceleratorFont | |||||||||||
acceleratorForeground | |||||||||||
acceleratorSelectionForeground | |||||||||||
arrowIcon | |||||||||||
checkIcon | |||||||||||
defaultTextIconGap | |||||||||||
disabledForeground | |||||||||||
menuDragMouseListener | |||||||||||
menuItem | |||||||||||
menuKeyListener | |||||||||||
mouseInputListener | |||||||||||
oldBorderPainted | |||||||||||
propertyChangeListener | PropertyChangeListener returned from
createPropertyChangeListener . |
||||||||||
selectionBackground | |||||||||||
selectionForeground |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
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.
| |||||||||||
Returns the specified component's preferred size appropriate for
the look and feel.
| |||||||||||
Configures the specified component appropriate for the look and feel.
| |||||||||||
Paints the specified component appropriate for the look and feel.
| |||||||||||
Reverses configuration which was done on the specified component during
installUI . | |||||||||||
We draw the background in paintMenuItem()
so override update (which fills the background of opaque
components by default) to just call paint().
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
PropertyChangeListener
returned from
createPropertyChangeListener
. You should not
need to access this field, rather if you want to customize the
PropertyChangeListener
override
createPropertyChangeListener
.
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.
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 |
---|
Dimension
object or null
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.
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 |
---|
Dimension
object or null
Returns the specified component's preferred size appropriate for
the look and feel. If null
is returned, the preferred
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 returns null
.
c | the component whose preferred size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components |
---|
Configures the specified component appropriate 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:
LayoutManager
on the component if necessary.
PropertyChangeListener
on the component in order
to detect and respond to component property changes appropriately.
c | the component where this UI delegate is being installed |
---|
Paints the specified component appropriate for the look and feel.
This method is invoked from the ComponentUI.update
method when
the specified component is being painted. Subclasses should override
this method and use the specified Graphics
object to
render the content of the component.
g | the Graphics context in which to paint |
---|---|
c | the component being painted; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components |
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:
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 |
---|
We draw the background in paintMenuItem() so override update (which fills the background of opaque components by default) to just call paint().
g | the Graphics context in which to paint |
---|---|
c | the component being painted; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components |
Creates a PropertyChangeListener
which will be added to
the menu item.
If this method returns null then it will not be added to the menu item.
PropertyChangeListener
or nullCall this method when a menu item is to be activated. This method handles some of the details of menu item activation such as clearing the selected path and messaging the JMenuItem's doClick() method.
msm | A MenuSelectionManager. The visual feedback and
internal bookkeeping tasks are delegated to
this MenuSelectionManager. If null is
passed as this argument, the
MenuSelectionManager.defaultManager is
used. |
---|
Draws the background of the menu item.
g | the paint graphics |
---|---|
menuItem | menu item to be painted |
bgColor | selection background color |
Renders the text of the current menu item.
g | graphics context |
---|---|
menuItem | menu item to render |
textRect | bounding rectangle for rendering the text |
text | string to render |