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

public Class BasicMenuItemUI

extends MenuItemUI
Class Inheritance
Known Direct Subclasses
javax.swing.plaf.basic.BasicMenuUI, javax.swing.plaf.basic.BasicRadioButtonMenuItemUI, javax.swing.plaf.synth.SynthMenuItemUI, com.sun.java.swing.plaf.motif.MotifMenuItemUI, javax.swing.plaf.basic.BasicCheckBoxMenuItemUI
Imports
java.awt.Color, .Component, .Dimension, .Font, .FontMetrics, .Graphics, .Insets, .Point, .Rectangle, java.awt.event.ActionEvent, .InputEvent, .MouseEvent, java.beans.PropertyChangeEvent, .PropertyChangeListener, javax.swing.ButtonModel, .Icon, .InputMap, .JCheckBoxMenuItem, .JComponent, .JMenu, .JMenuItem, .JRadioButtonMenuItem, .KeyStroke, .LookAndFeel, .MenuElement, .MenuSelectionManager, .SwingUtilities, .UIManager, javax.swing.event.MenuDragMouseEvent, .MenuDragMouseListener, .MenuKeyListener, .MouseInputListener, javax.swing.plaf.ComponentInputMapUIResource, .ComponentUI, .MenuItemUI, .UIResource, javax.swing.text.View, com.sun.java.swing.SwingUtilities3, sun.swing.MenuItemCheckIconFactory, .MenuItemLayoutHelper, .SwingUtilities2, .UIAction

BasicMenuItem implementation
Authors
Georges Saab, David Karlton, Arnaud Weber, Fredrik Lagerblad

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
pack-priv class
protected class
BasicMenuItemUI.MouseInputHandler

Deprecated for removal since 17.
Mouse input handler.

Field Summary

Modifier and TypeField and Description
protected String
acceleratorDelimiter

Accelerator delimiter string, such as '+' in 'Ctrl+C'.

protected Font
acceleratorFont

The accelerator font.

protected Color
acceleratorForeground

The color of the accelerator foreground.

protected Color
acceleratorSelectionForeground

The color of the accelerator selection.

protected Icon
arrowIcon

The arrow icon.

protected Icon
checkIcon

The check icon.

private static final boolean
protected int
defaultTextIconGap

The gap between the text and the icon.

protected Color
disabledForeground

The color of the disabled foreground.

pack-priv BasicMenuItemUI.Handler
protected MouseInputListener
mouseInputListener

The instance of MouseInputListener.

protected boolean
oldBorderPainted

The value represents if the old border is painted.

protected PropertyChangeListener
propertyChangeListener

PropertyChangeListener returned from createPropertyChangeListener.

protected Color
selectionBackground

The color of the selection background.

protected Color
selectionForeground

The color of the selection foreground.

private static final boolean
private static final boolean

Constructor Summary

AccessConstructor and Description
public
BasicMenuItemUI()

Constructs a BasicMenuItemUI.

Method Summary

Modifier and TypeMethod and Description
pack-priv InputMap
createInputMap(int condition)

protected MenuDragMouseListener

Returns:

an instance of MenuDragMouseListener
createMenuDragMouseListener
(JComponent
a component
c
)

Returns an instance of MenuDragMouseListener.

protected MenuKeyListener

Returns:

an instance of MenuKeyListener
createMenuKeyListener
(JComponent
a component
c
)

Returns an instance of MenuKeyListener.

protected MouseInputListener

Returns:

an instance of MouseInputListener
createMouseInputListener
(JComponent
a component
c
)

Returns an instance of MouseInputListener.

protected PropertyChangeListener

Returns:

an instance of a PropertyChangeListener or null
createPropertyChangeListener
(JComponent
a component
c
)

Creates a PropertyChangeListener which will be added to the menu item.

public static ComponentUI

Returns:

a new instance of BasicMenuItemUI
createUI
(JComponent
a component
c
)

Hides javax.swing.plaf.ComponentUI.createUI.

Returns a new instance of BasicMenuItemUI.

protected void
doClick(MenuSelectionManager
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.
msm
)

Call this method when a menu item is to be activated.

pack-priv boolean
pack-priv BasicMenuItemUI.Handler
public Dimension
getMaximumSize(JComponent c)

Overrides javax.swing.plaf.ComponentUI.getMaximumSize.

Returns the specified component's maximum size appropriate for the look and feel.

public Dimension
getMinimumSize(JComponent c)

Overrides javax.swing.plaf.ComponentUI.getMinimumSize.

Returns the specified component's minimum size appropriate for the look and feel.

public MenuElement[]

Returns:

a menu element path
getPath
()

Returns a menu element path.

protected Dimension

Returns:

the preferred size of a menu item
getPreferredMenuItemSize
(JComponent
a component
c
,
Icon
a check icon
checkIcon
,
Icon
an arrow icon
arrowIcon
,
int
a gap between a text and an icon
defaultTextIconGap
)

Returns the preferred size of a menu item.

public Dimension
getPreferredSize(JComponent c)

Overrides javax.swing.plaf.ComponentUI.getPreferredSize.

Returns the specified component's preferred size appropriate for the look and feel.

protected String

Returns:

a property prefix
getPropertyPrefix
()

Returns a property prefix.

protected void
installComponents(JMenuItem
a menu item
menuItem
)

Registers the subcomponents of the menu.

protected void
installDefaults()

Installs default properties.

protected void
installKeyboardActions()

Registers keyboard action.

pack-priv void
protected void
installListeners()

Registers listeners.

public void
installUI(JComponent c)

Overrides javax.swing.plaf.ComponentUI.installUI.

Configures the specified component appropriately for the look and feel.

private boolean
isInternalFrameSystemMenu()

This is to see if the menu item in question is part of the system menu on an internal frame.

pack-priv static void
public void
paint(Graphics g, JComponent c)

Overrides javax.swing.plaf.ComponentUI.paint.

Paints the specified component appropriately for the look and feel.

private void
private void
protected void
paintBackground(Graphics
the paint graphics
g
,
JMenuItem
menu item to be painted
menuItem
,
Color
selection background color
bgColor
)

Draws the background of the menu item.

private void
private void
protected void
paintMenuItem(Graphics
an instance of Graphics
g
,
JComponent
a component
c
,
Icon
a check icon
checkIcon
,
Icon
an arrow icon
arrowIcon
,
Color
a background color
background
,
Color
a foreground color
foreground
,
int
a gap between a text and an icon
defaultTextIconGap
)

Paints a menu item.

private void
protected void
paintText(Graphics
graphics context
g
,
JMenuItem
menu item to render
menuItem
,
Rectangle
bounding rectangle for rendering the text
textRect
,
String
string to render
text
)

Renders the text of the current menu item.

pack-priv void
printMenuElementArray(MenuElement[] path, boolean dumpStack)

protected void
uninstallComponents(JMenuItem
a menu item
menuItem
)

Unregisters components.

protected void
uninstallDefaults()

Uninstalls default properties.

protected void
uninstallKeyboardActions()

Unregisters keyboard actions.

protected void
uninstallListeners()

Unregisters listeners.

public void
uninstallUI(JComponent c)

Overrides javax.swing.plaf.ComponentUI.uninstallUI.

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

public void
update(Graphics g, JComponent c)

Overrides javax.swing.plaf.ComponentUI.update.

We draw the background in paintMenuItem() so override update (which fills the background of opaque components by default) to just call paint().

pack-priv void

Field Detail

acceleratorDelimiterback to summary
protected String acceleratorDelimiter

Accelerator delimiter string, such as '+' in 'Ctrl+C'.

Since
1.7
acceleratorFontback to summary
protected Font acceleratorFont

The accelerator font.

acceleratorForegroundback to summary
protected Color acceleratorForeground

The color of the accelerator foreground.

acceleratorSelectionForegroundback to summary
protected Color acceleratorSelectionForeground

The color of the accelerator selection.

arrowIconback to summary
protected Icon arrowIcon

The arrow icon.

checkIconback to summary
protected Icon checkIcon

The check icon.

DEBUGback to summary
private static final boolean DEBUG
defaultTextIconGapback to summary
protected int defaultTextIconGap

The gap between the text and the icon.

disabledForegroundback to summary
protected Color disabledForeground

The color of the disabled foreground.

handlerback to summary
pack-priv BasicMenuItemUI.Handler handler
mouseInputListenerback to summary
protected MouseInputListener mouseInputListener

The instance of MouseInputListener.

oldBorderPaintedback to summary
protected boolean oldBorderPainted

The value represents if the old border is painted.

propertyChangeListenerback to summary
protected PropertyChangeListener propertyChangeListener

PropertyChangeListener returned from createPropertyChangeListener. You should not need to access this field, rather if you want to customize the PropertyChangeListener override createPropertyChangeListener.

Since
1.6
See Also
createPropertyChangeListener
selectionBackgroundback to summary
protected Color selectionBackground

The color of the selection background.

selectionForegroundback to summary
protected Color selectionForeground

The color of the selection foreground.

TRACEback to summary
private static final boolean TRACE
VERBOSEback to summary
private static final boolean VERBOSE

Constructor Detail

BasicMenuItemUIback to summary
public BasicMenuItemUI()

Constructs a BasicMenuItemUI.

Method Detail

createInputMapback to summary
pack-priv InputMap createInputMap(int condition)
createMenuDragMouseListenerback to summary
protected MenuDragMouseListener createMenuDragMouseListener(JComponent c)

Returns an instance of MenuDragMouseListener.

Parameters
c:JComponent

a component

Returns:MenuDragMouseListener

an instance of MenuDragMouseListener

createMenuKeyListenerback to summary
protected MenuKeyListener createMenuKeyListener(JComponent c)

Returns an instance of MenuKeyListener.

Parameters
c:JComponent

a component

Returns:MenuKeyListener

an instance of MenuKeyListener

createMouseInputListenerback to summary
protected MouseInputListener createMouseInputListener(JComponent c)

Returns an instance of MouseInputListener.

Parameters
c:JComponent

a component

Returns:MouseInputListener

an instance of MouseInputListener

createPropertyChangeListenerback to summary
protected PropertyChangeListener createPropertyChangeListener(JComponent c)

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.

Parameters
c:JComponent

a component

Returns:PropertyChangeListener

an instance of a PropertyChangeListener or null

Since
1.6
createUIback to summary
public static ComponentUI createUI(JComponent c)

Hides javax.swing.plaf.ComponentUI.createUI.

Returns a new instance of BasicMenuItemUI.

Parameters
c:JComponent

a component

Returns:ComponentUI

a new instance of BasicMenuItemUI

doClickback to summary
protected void doClick(MenuSelectionManager msm)

Call 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.

Parameters
msm:MenuSelectionManager

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.

Since
1.4
See Also
MenuSelectionManager, JMenuItem#doClick(int)
doNotCloseOnMouseClickback to summary
pack-priv boolean doNotCloseOnMouseClick()
getHandlerback to summary
pack-priv BasicMenuItemUI.Handler getHandler()
getMaximumSizeback to summary
public Dimension getMaximumSize(JComponent c)

Overrides javax.swing.plaf.ComponentUI.getMaximumSize.

Doc from javax.swing.plaf.ComponentUI.getMaximumSize.

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.

getMinimumSizeback to summary
public Dimension getMinimumSize(JComponent c)

Overrides javax.swing.plaf.ComponentUI.getMinimumSize.

Doc from javax.swing.plaf.ComponentUI.getMinimumSize.

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.

getPathback to summary
public MenuElement[] getPath()

Returns a menu element path.

Returns:MenuElement[]

a menu element path

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

Returns the preferred size of a menu item.

Parameters
c:JComponent

a component

checkIcon:Icon

a check icon

arrowIcon:Icon

an arrow icon

defaultTextIconGap:int

a gap between a text and an icon

Returns:Dimension

the preferred size of a menu item

getPreferredSizeback to summary
public Dimension getPreferredSize(JComponent c)

Overrides javax.swing.plaf.ComponentUI.getPreferredSize.

Doc from javax.swing.plaf.ComponentUI.getPreferredSize.

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.

getPropertyPrefixback to summary
protected String getPropertyPrefix()

Returns a property prefix.

Returns:String

a property prefix

installComponentsback to summary
protected void installComponents(JMenuItem menuItem)

Registers the subcomponents of the menu.

Parameters
menuItem:JMenuItem

a menu item

Since
1.3
installDefaultsback to summary
protected void installDefaults()

Installs default properties.

installKeyboardActionsback to summary
protected void installKeyboardActions()

Registers keyboard action.

installLazyActionMapback to summary
pack-priv void installLazyActionMap()
installListenersback to summary
protected void installListeners()

Registers listeners.

installUIback to summary
public void installUI(JComponent c)

Overrides javax.swing.plaf.ComponentUI.installUI.

Doc from javax.swing.plaf.ComponentUI.installUI.

Configures the specified component appropriately 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:

  1. 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.
  2. Install a LayoutManager on the component if necessary.
  3. Create/add any required sub-components to the component.
  4. Create/install event listeners on the component.
  5. Create/install a PropertyChangeListener on the component in order to detect and respond to component property changes appropriately.
  6. Install keyboard UI (mnemonics, traversal, etc.) on the component.
  7. Initialize any appropriate instance data.
isInternalFrameSystemMenuback to summary
private boolean isInternalFrameSystemMenu()

This is to see if the menu item in question is part of the system menu on an internal frame. The Strings that are being checked can be found in MetalInternalFrameTitlePaneUI.java, WindowsInternalFrameTitlePaneUI.java, and MotifInternalFrameTitlePaneUI.java.

Since
1.4
loadActionMapback to summary
pack-priv static void loadActionMap(LazyActionMap map)
paintback to summary
public void paint(Graphics g, JComponent c)

Overrides javax.swing.plaf.ComponentUI.paint.

Doc from javax.swing.plaf.ComponentUI.paint.

Paints the specified component appropriately 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.

paintAccTextback to summary
private void paintAccText(Graphics g, MenuItemLayoutHelper lh, MenuItemLayoutHelper.LayoutResult lr)
paintArrowIconback to summary
private void paintArrowIcon(Graphics g, MenuItemLayoutHelper lh, MenuItemLayoutHelper.LayoutResult lr, Color foreground)
paintBackgroundback to summary
protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor)

Draws the background of the menu item.

Parameters
g:Graphics

the paint graphics

menuItem:JMenuItem

menu item to be painted

bgColor:Color

selection background color

Since
1.4
paintCheckIconback to summary
private void paintCheckIcon(Graphics g, MenuItemLayoutHelper lh, MenuItemLayoutHelper.LayoutResult lr, Color holdc, Color foreground)
paintIconback to summary
private void paintIcon(Graphics g, MenuItemLayoutHelper lh, MenuItemLayoutHelper.LayoutResult lr, Color holdc)
paintMenuItemback to summary
protected void paintMenuItem(Graphics g, JComponent c, Icon checkIcon, Icon arrowIcon, Color background, Color foreground, int defaultTextIconGap)

Paints a menu item.

Parameters
g:Graphics

an instance of Graphics

c:JComponent

a component

checkIcon:Icon

a check icon

arrowIcon:Icon

an arrow icon

background:Color

a background color

foreground:Color

a foreground color

defaultTextIconGap:int

a gap between a text and an icon

paintTextback to summary
private void paintText(Graphics g, MenuItemLayoutHelper lh, MenuItemLayoutHelper.LayoutResult lr)
paintTextback to summary
protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text)

Renders the text of the current menu item.

Parameters
g:Graphics

graphics context

menuItem:JMenuItem

menu item to render

textRect:Rectangle

bounding rectangle for rendering the text

text:String

string to render

Since
1.4
printMenuElementArrayback to summary
pack-priv void printMenuElementArray(MenuElement[] path, boolean dumpStack)
uninstallComponentsback to summary
protected void uninstallComponents(JMenuItem menuItem)

Unregisters components.

Parameters
menuItem:JMenuItem

a menu item

Since
1.3
uninstallDefaultsback to summary
protected void uninstallDefaults()

Uninstalls default properties.

uninstallKeyboardActionsback to summary
protected void uninstallKeyboardActions()

Unregisters keyboard actions.

uninstallListenersback to summary
protected void uninstallListeners()

Unregisters listeners.

uninstallUIback to summary
public void uninstallUI(JComponent c)

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

Overrides javax.swing.plaf.ComponentUI.update.

We draw the background in paintMenuItem() so override update (which fills the background of opaque components by default) to just call paint().

updateAcceleratorBindingback to summary
pack-priv void updateAcceleratorBinding()
Annotations
@SuppressWarnings:deprecation
javax.swing.plaf.basic back to summary

private Class BasicMenuItemUI.Actions

extends UIAction
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
actionPerformed(ActionEvent e)

Implements java.awt.event.ActionListener.actionPerformed.

Invoked when an action occurs.

Inherited from sun.swing.UIAction:
acceptaddPropertyChangeListenergetNamegetValueisEnabledputValueremovePropertyChangeListenersetEnabled

Field Detail

CLICKback to summary
private static final String CLICK

Constructor Detail

Actionsback to summary
pack-priv Actions(String key)

Method Detail

actionPerformedback to summary
public void actionPerformed(ActionEvent e)

Implements java.awt.event.ActionListener.actionPerformed.

Doc from java.awt.event.ActionListener.actionPerformed.

Invoked when an action occurs.

javax.swing.plaf.basic back to summary

pack-priv Class BasicMenuItemUI.Handler

extends Object
implements MenuDragMouseListener, MouseInputListener, PropertyChangeListener
Class Inheritance
All Implemented Interfaces
java.beans.PropertyChangeListener, java.util.EventListener, javax.swing.event.MouseInputListener, java.awt.event.MouseMotionListener, java.awt.event.MouseListener, javax.swing.event.MenuDragMouseListener
Known Direct Subclasses
javax.swing.plaf.basic.BasicMenuUI.Handler

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
menuDragMouseDragged(MenuDragMouseEvent e)

Implements javax.swing.event.MenuDragMouseListener.menuDragMouseDragged.

Invoked when the mouse is being dragged in a menu component's display area.

public void
menuDragMouseEntered(MenuDragMouseEvent e)

Implements javax.swing.event.MenuDragMouseListener.menuDragMouseEntered.

Invoked when the dragged mouse has entered a menu component's display area.

public void
menuDragMouseExited(MenuDragMouseEvent e)

Implements javax.swing.event.MenuDragMouseListener.menuDragMouseExited.

Invoked when the dragged mouse has left a menu component's display area.

public void
menuDragMouseReleased(MenuDragMouseEvent e)

Implements javax.swing.event.MenuDragMouseListener.menuDragMouseReleased.

Invoked when a dragged mouse is release in a menu component's display area.

public void
mouseClicked(MouseEvent e)

Implements java.awt.event.MouseListener.mouseClicked.

Invoked when the mouse button has been clicked (pressed and released) on a component.

public void
mouseDragged(MouseEvent e)

Implements java.awt.event.MouseMotionListener.mouseDragged.

Invoked when a mouse button is pressed on a component and then dragged.

public void
mouseEntered(MouseEvent e)

Implements java.awt.event.MouseListener.mouseEntered.

Invoked when the mouse enters a component.

public void
mouseExited(MouseEvent e)

Implements java.awt.event.MouseListener.mouseExited.

Invoked when the mouse exits a component.

public void
mouseMoved(MouseEvent e)

Implements java.awt.event.MouseMotionListener.mouseMoved.

Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.

public void
mousePressed(MouseEvent e)

Implements java.awt.event.MouseListener.mousePressed.

Invoked when a mouse button has been pressed on a component.

public void
mouseReleased(MouseEvent e)

Implements java.awt.event.MouseListener.mouseReleased.

Invoked when a mouse button has been released on a component.

public void
propertyChange(PropertyChangeEvent e)

Implements java.beans.PropertyChangeListener.propertyChange.

This method gets called when a bound property is changed.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Handlerback to summary
pack-priv Handler()

Method Detail

menuDragMouseDraggedback to summary
public void menuDragMouseDragged(MenuDragMouseEvent e)

Implements javax.swing.event.MenuDragMouseListener.menuDragMouseDragged.

Doc from javax.swing.event.MenuDragMouseListener.menuDragMouseDragged.

Invoked when the mouse is being dragged in a menu component's display area.

menuDragMouseEnteredback to summary
public void menuDragMouseEntered(MenuDragMouseEvent e)

Implements javax.swing.event.MenuDragMouseListener.menuDragMouseEntered.

Doc from javax.swing.event.MenuDragMouseListener.menuDragMouseEntered.

Invoked when the dragged mouse has entered a menu component's display area.

menuDragMouseExitedback to summary
public void menuDragMouseExited(MenuDragMouseEvent e)

Implements javax.swing.event.MenuDragMouseListener.menuDragMouseExited.

Doc from javax.swing.event.MenuDragMouseListener.menuDragMouseExited.

Invoked when the dragged mouse has left a menu component's display area.

menuDragMouseReleasedback to summary
public void menuDragMouseReleased(MenuDragMouseEvent e)

Implements javax.swing.event.MenuDragMouseListener.menuDragMouseReleased.

Doc from javax.swing.event.MenuDragMouseListener.menuDragMouseReleased.

Invoked when a dragged mouse is release in a menu component's display area.

mouseClickedback to summary
public void mouseClicked(MouseEvent e)

Implements java.awt.event.MouseListener.mouseClicked.

Doc from java.awt.event.MouseListener.mouseClicked.

Invoked when the mouse button has been clicked (pressed and released) on a component.

mouseDraggedback to summary
public void mouseDragged(MouseEvent e)

Implements java.awt.event.MouseMotionListener.mouseDragged.

Doc from java.awt.event.MouseMotionListener.mouseDragged.

Invoked when a mouse button is pressed on a component and then dragged. MOUSE_DRAGGED events will continue to be delivered to the component where the drag originated until the mouse button is released (regardless of whether the mouse position is within the bounds of the component).

Due to platform-dependent Drag&Drop implementations, MOUSE_DRAGGED events may not be delivered during a native Drag&Drop operation.

mouseEnteredback to summary
public void mouseEntered(MouseEvent e)

Implements java.awt.event.MouseListener.mouseEntered.

Doc from java.awt.event.MouseListener.mouseEntered.

Invoked when the mouse enters a component.

Annotations
@SuppressWarnings:deprecation
mouseExitedback to summary
public void mouseExited(MouseEvent e)

Implements java.awt.event.MouseListener.mouseExited.

Doc from java.awt.event.MouseListener.mouseExited.

Invoked when the mouse exits a component.

Annotations
@SuppressWarnings:deprecation
mouseMovedback to summary
public void mouseMoved(MouseEvent e)

Implements java.awt.event.MouseMotionListener.mouseMoved.

Doc from java.awt.event.MouseMotionListener.mouseMoved.

Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.

mousePressedback to summary
public void mousePressed(MouseEvent e)

Implements java.awt.event.MouseListener.mousePressed.

Doc from java.awt.event.MouseListener.mousePressed.

Invoked when a mouse button has been pressed on a component.

mouseReleasedback to summary
public void mouseReleased(MouseEvent e)

Implements java.awt.event.MouseListener.mouseReleased.

Doc from java.awt.event.MouseListener.mouseReleased.

Invoked when a mouse button has been released on a component.

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.

javax.swing.plaf.basic back to summary

protected Class BasicMenuItemUI.MouseInputHandler

extends Object
implements MouseInputListener
Class Inheritance
All Implemented Interfaces
javax.swing.event.MouseInputListener, java.awt.event.MouseMotionListener, java.util.EventListener, java.awt.event.MouseListener
Annotations
@Deprecated
since:17
forRemoval:true

Deprecated

for removal since 17.

Mouse input handler. This class exists only for backward compatibility. All its functionality has been moved into Handler.

Constructor Summary

AccessConstructor and Description
protected
MouseInputHandler()

Constructs a MouseInputHandler.

Method Summary

Modifier and TypeMethod and Description
public void
mouseClicked(MouseEvent e)

Implements java.awt.event.MouseListener.mouseClicked.

Invoked when the mouse button has been clicked (pressed and released) on a component.

public void
mouseDragged(MouseEvent e)

Implements java.awt.event.MouseMotionListener.mouseDragged.

Invoked when a mouse button is pressed on a component and then dragged.

public void
mouseEntered(MouseEvent e)

Implements java.awt.event.MouseListener.mouseEntered.

Invoked when the mouse enters a component.

public void
mouseExited(MouseEvent e)

Implements java.awt.event.MouseListener.mouseExited.

Invoked when the mouse exits a component.

public void
mouseMoved(MouseEvent e)

Implements java.awt.event.MouseMotionListener.mouseMoved.

Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.

public void
mousePressed(MouseEvent e)

Implements java.awt.event.MouseListener.mousePressed.

Invoked when a mouse button has been pressed on a component.

public void
mouseReleased(MouseEvent e)

Implements java.awt.event.MouseListener.mouseReleased.

Invoked when a mouse button has been released on a component.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

MouseInputHandlerback to summary
protected MouseInputHandler()

Constructs a MouseInputHandler.

Method Detail

mouseClickedback to summary
public void mouseClicked(MouseEvent e)

Implements java.awt.event.MouseListener.mouseClicked.

Doc from java.awt.event.MouseListener.mouseClicked.

Invoked when the mouse button has been clicked (pressed and released) on a component.

mouseDraggedback to summary
public void mouseDragged(MouseEvent e)

Implements java.awt.event.MouseMotionListener.mouseDragged.

Doc from java.awt.event.MouseMotionListener.mouseDragged.

Invoked when a mouse button is pressed on a component and then dragged. MOUSE_DRAGGED events will continue to be delivered to the component where the drag originated until the mouse button is released (regardless of whether the mouse position is within the bounds of the component).

Due to platform-dependent Drag&Drop implementations, MOUSE_DRAGGED events may not be delivered during a native Drag&Drop operation.

mouseEnteredback to summary
public void mouseEntered(MouseEvent e)

Implements java.awt.event.MouseListener.mouseEntered.

Doc from java.awt.event.MouseListener.mouseEntered.

Invoked when the mouse enters a component.

mouseExitedback to summary
public void mouseExited(MouseEvent e)

Implements java.awt.event.MouseListener.mouseExited.

Doc from java.awt.event.MouseListener.mouseExited.

Invoked when the mouse exits a component.

mouseMovedback to summary
public void mouseMoved(MouseEvent e)

Implements java.awt.event.MouseMotionListener.mouseMoved.

Doc from java.awt.event.MouseMotionListener.mouseMoved.

Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.

mousePressedback to summary
public void mousePressed(MouseEvent e)

Implements java.awt.event.MouseListener.mousePressed.

Doc from java.awt.event.MouseListener.mousePressed.

Invoked when a mouse button has been pressed on a component.

mouseReleasedback to summary
public void mouseReleased(MouseEvent e)

Implements java.awt.event.MouseListener.mouseReleased.

Doc from java.awt.event.MouseListener.mouseReleased.

Invoked when a mouse button has been released on a component.