< prev index next >
src/java.desktop/share/classes/javax/swing/JMenuItem.java
Print this page
*** 43,60 ****
import javax.accessibility.*;
/**
* An implementation of an item in a menu. A menu item is essentially a button
* sitting in a list. When the user selects the "button", the action
! * associated with the menu item is performed. A <code>JMenuItem</code>
! * contained in a <code>JPopupMenu</code> performs exactly that function.
* <p>
* Menu items can be configured, and to some degree controlled, by
* <code><a href="Action.html">Action</a></code>s. Using an
! * <code>Action</code> with a menu item has many benefits beyond directly
* configuring a menu item. Refer to <a href="Action.html#buttonActions">
! * Swing Components Supporting <code>Action</code></a> for more
* details, and you can find more information in <a
* href="http://docs.oracle.com/javase/tutorial/uiswing/misc/action.html">How
* to Use Actions</a>, a section in <em>The Java Tutorial</em>.
* <p>
* For further documentation and for examples, see
--- 43,60 ----
import javax.accessibility.*;
/**
* An implementation of an item in a menu. A menu item is essentially a button
* sitting in a list. When the user selects the "button", the action
! * associated with the menu item is performed. A {@code JMenuItem}
! * contained in a {@code JPopupMenu} performs exactly that function.
* <p>
* Menu items can be configured, and to some degree controlled, by
* <code><a href="Action.html">Action</a></code>s. Using an
! * {@code Action} with a menu item has many benefits beyond directly
* configuring a menu item. Refer to <a href="Action.html#buttonActions">
! * Swing Components Supporting {@code Action}</a> for more
* details, and you can find more information in <a
* href="http://docs.oracle.com/javase/tutorial/uiswing/misc/action.html">How
* to Use Actions</a>, a section in <em>The Java Tutorial</em>.
* <p>
* For further documentation and for examples, see
*** 71,81 ****
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @beaninfo
* attribute: isContainer false
* description: An item which can be selected in a menu.
--- 71,81 ----
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*
* @beaninfo
* attribute: isContainer false
* description: An item which can be selected in a menu.
*** 103,166 ****
private static final boolean DEBUG = false; // show bad params, misc.
private boolean isMouseDragged = false;
/**
! * Creates a <code>JMenuItem</code> with no set text or icon.
*/
public JMenuItem() {
this(null, (Icon)null);
}
/**
! * Creates a <code>JMenuItem</code> with the specified icon.
*
! * @param icon the icon of the <code>JMenuItem</code>
*/
public JMenuItem(Icon icon) {
this(null, icon);
}
/**
! * Creates a <code>JMenuItem</code> with the specified text.
*
! * @param text the text of the <code>JMenuItem</code>
*/
public JMenuItem(String text) {
this(text, (Icon)null);
}
/**
* Creates a menu item whose properties are taken from the
! * specified <code>Action</code>.
*
! * @param a the action of the <code>JMenuItem</code>
* @since 1.3
*/
public JMenuItem(Action a) {
this();
setAction(a);
}
/**
! * Creates a <code>JMenuItem</code> with the specified text and icon.
*
! * @param text the text of the <code>JMenuItem</code>
! * @param icon the icon of the <code>JMenuItem</code>
*/
public JMenuItem(String text, Icon icon) {
setModel(new DefaultButtonModel());
init(text, icon);
initFocusability();
}
/**
! * Creates a <code>JMenuItem</code> with the specified text and
* keyboard mnemonic.
*
! * @param text the text of the <code>JMenuItem</code>
! * @param mnemonic the keyboard mnemonic for the <code>JMenuItem</code>
*/
public JMenuItem(String text, int mnemonic) {
setModel(new DefaultButtonModel());
init(text, null);
setMnemonic(mnemonic);
--- 103,166 ----
private static final boolean DEBUG = false; // show bad params, misc.
private boolean isMouseDragged = false;
/**
! * Creates a {@code JMenuItem} with no set text or icon.
*/
public JMenuItem() {
this(null, (Icon)null);
}
/**
! * Creates a {@code JMenuItem} with the specified icon.
*
! * @param icon the icon of the {@code JMenuItem}
*/
public JMenuItem(Icon icon) {
this(null, icon);
}
/**
! * Creates a {@code JMenuItem} with the specified text.
*
! * @param text the text of the {@code JMenuItem}
*/
public JMenuItem(String text) {
this(text, (Icon)null);
}
/**
* Creates a menu item whose properties are taken from the
! * specified {@code Action}.
*
! * @param a the action of the {@code JMenuItem}
* @since 1.3
*/
public JMenuItem(Action a) {
this();
setAction(a);
}
/**
! * Creates a {@code JMenuItem} with the specified text and icon.
*
! * @param text the text of the {@code JMenuItem}
! * @param icon the icon of the {@code JMenuItem}
*/
public JMenuItem(String text, Icon icon) {
setModel(new DefaultButtonModel());
init(text, icon);
initFocusability();
}
/**
! * Creates a {@code JMenuItem} with the specified text and
* keyboard mnemonic.
*
! * @param text the text of the {@code JMenuItem}
! * @param mnemonic the keyboard mnemonic for the {@code JMenuItem}
*/
public JMenuItem(String text, int mnemonic) {
setModel(new DefaultButtonModel());
init(text, null);
setMnemonic(mnemonic);
*** 176,187 ****
((DefaultButtonModel)newModel).setMenuItem(true);
}
}
/**
! * Inititalizes the focusability of the <code>JMenuItem</code>.
! * <code>JMenuItem</code>'s are focusable, but subclasses may
* want to be, this provides them the opportunity to override this
* and invoke something else, or nothing at all. Refer to
* {@link javax.swing.JMenu#initFocusability} for the motivation of
* this.
*/
--- 176,187 ----
((DefaultButtonModel)newModel).setMenuItem(true);
}
}
/**
! * Inititalizes the focusability of the {@code JMenuItem}.
! * {@code JMenuItem}'s are focusable, but subclasses may
* want to be, this provides them the opportunity to override this
* and invoke something else, or nothing at all. Refer to
* {@link javax.swing.JMenu#initFocusability} for the motivation of
* this.
*/
*** 190,201 ****
}
/**
* Initializes the menu item with the specified text and icon.
*
! * @param text the text of the <code>JMenuItem</code>
! * @param icon the icon of the <code>JMenuItem</code>
*/
protected void init(String text, Icon icon) {
if(text != null) {
setText(text);
}
--- 190,201 ----
}
/**
* Initializes the menu item with the specified text and icon.
*
! * @param text the text of the {@code JMenuItem}
! * @param icon the icon of the {@code JMenuItem}
*/
protected void init(String text, Icon icon) {
if(text != null) {
setText(text);
}
*** 228,238 ****
/**
* Sets the look and feel object that renders this component.
*
! * @param ui the <code>JMenuItemUI</code> L&F object
* @see UIDefaults#getUI
* @beaninfo
* bound: true
* hidden: true
* attribute: visualUpdate true
--- 228,238 ----
/**
* Sets the look and feel object that renders this component.
*
! * @param ui the {@code JMenuItemUI} L&F object
* @see UIDefaults#getUI
* @beaninfo
* bound: true
* hidden: true
* attribute: visualUpdate true
*** 313,323 ****
super.setEnabled(b);
}
/**
! * Returns true since <code>Menu</code>s, by definition,
* should always be on top of all other windows. If the menu is
* in an internal frame false is returned due to the rollover effect
* for windows laf where the menu is not always on top.
*/
// package private
--- 313,323 ----
super.setEnabled(b);
}
/**
! * Returns true since {@code Menu}s, by definition,
* should always be on top of all other windows. If the menu is
* in an internal frame false is returned due to the rollover effect
* for windows laf where the menu is not always on top.
*/
// package private
*** 340,350 ****
* action listeners without navigating the menu hierarchy. It is the
* UI's responsibility to install the correct action. Note that
* when the keyboard accelerator is typed, it will work whether or
* not the menu is currently displayed.
*
! * @param keyStroke the <code>KeyStroke</code> which will
* serve as an accelerator
* @beaninfo
* description: The keystroke combination which will invoke the
* JMenuItem's actionlisteners without navigating the
* menu hierarchy
--- 340,350 ----
* action listeners without navigating the menu hierarchy. It is the
* UI's responsibility to install the correct action. Note that
* when the keyboard accelerator is typed, it will work whether or
* not the menu is currently displayed.
*
! * @param keyStroke the {@code KeyStroke} which will
* serve as an accelerator
* @beaninfo
* description: The keystroke combination which will invoke the
* JMenuItem's actionlisteners without navigating the
* menu hierarchy
*** 358,370 ****
revalidate();
firePropertyChange("accelerator", oldAccelerator, accelerator);
}
/**
! * Returns the <code>KeyStroke</code> which serves as an accelerator
* for the menu item.
! * @return a <code>KeyStroke</code> object identifying the
* accelerator key
*/
public KeyStroke getAccelerator() {
return this.accelerator;
}
--- 358,370 ----
revalidate();
firePropertyChange("accelerator", oldAccelerator, accelerator);
}
/**
! * Returns the {@code KeyStroke} which serves as an accelerator
* for the menu item.
! * @return a {@code KeyStroke} object identifying the
* accelerator key
*/
public KeyStroke getAccelerator() {
return this.accelerator;
}
*** 413,432 ****
}
}
/**
* Processes a mouse event forwarded from the
! * <code>MenuSelectionManager</code> and changes the menu
* selection, if necessary, by using the
! * <code>MenuSelectionManager</code>'s API.
* <p>
* Note: you do not have to forward the event to sub-components.
! * This is done automatically by the <code>MenuSelectionManager</code>.
*
! * @param e a <code>MouseEvent</code>
! * @param path the <code>MenuElement</code> path array
! * @param manager the <code>MenuSelectionManager</code>
*/
public void processMouseEvent(MouseEvent e,MenuElement path[],MenuSelectionManager manager) {
processMenuDragMouseEvent(
new MenuDragMouseEvent(e.getComponent(), e.getID(),
e.getWhen(),
--- 413,432 ----
}
}
/**
* Processes a mouse event forwarded from the
! * {@code MenuSelectionManager} and changes the menu
* selection, if necessary, by using the
! * {@code MenuSelectionManager}'s API.
* <p>
* Note: you do not have to forward the event to sub-components.
! * This is done automatically by the {@code MenuSelectionManager}.
*
! * @param e a {@code MouseEvent}
! * @param path the {@code MenuElement} path array
! * @param manager the {@code MenuSelectionManager}
*/
public void processMouseEvent(MouseEvent e,MenuElement path[],MenuSelectionManager manager) {
processMenuDragMouseEvent(
new MenuDragMouseEvent(e.getComponent(), e.getID(),
e.getWhen(),
*** 437,455 ****
}
/**
* Processes a key event forwarded from the
! * <code>MenuSelectionManager</code> and changes the menu selection,
! * if necessary, by using <code>MenuSelectionManager</code>'s API.
* <p>
* Note: you do not have to forward the event to sub-components.
! * This is done automatically by the <code>MenuSelectionManager</code>.
*
! * @param e a <code>KeyEvent</code>
! * @param path the <code>MenuElement</code> path array
! * @param manager the <code>MenuSelectionManager</code>
*/
public void processKeyEvent(KeyEvent e,MenuElement path[],MenuSelectionManager manager) {
if (DEBUG) {
System.out.println("in JMenuItem.processKeyEvent/3 for " + getText() +
" " + KeyStroke.getKeyStrokeForEvent(e));
--- 437,455 ----
}
/**
* Processes a key event forwarded from the
! * {@code MenuSelectionManager} and changes the menu selection,
! * if necessary, by using {@code MenuSelectionManager}'s API.
* <p>
* Note: you do not have to forward the event to sub-components.
! * This is done automatically by the {@code MenuSelectionManager}.
*
! * @param e a {@code KeyEvent}
! * @param path the {@code MenuElement} path array
! * @param manager the {@code MenuSelectionManager}
*/
public void processKeyEvent(KeyEvent e,MenuElement path[],MenuSelectionManager manager) {
if (DEBUG) {
System.out.println("in JMenuItem.processKeyEvent/3 for " + getText() +
" " + KeyStroke.getKeyStrokeForEvent(e));
*** 468,478 ****
/**
* Handles mouse drag in a menu.
*
! * @param e a <code>MenuDragMouseEvent</code> object
*/
public void processMenuDragMouseEvent(MenuDragMouseEvent e) {
switch (e.getID()) {
case MouseEvent.MOUSE_ENTERED:
isMouseDragged = false; fireMenuDragMouseEntered(e); break;
--- 468,478 ----
/**
* Handles mouse drag in a menu.
*
! * @param e a {@code MenuDragMouseEvent} object
*/
public void processMenuDragMouseEvent(MenuDragMouseEvent e) {
switch (e.getID()) {
case MouseEvent.MOUSE_ENTERED:
isMouseDragged = false; fireMenuDragMouseEntered(e); break;
*** 488,498 ****
}
/**
* Handles a keystroke in a menu.
*
! * @param e a <code>MenuKeyEvent</code> object
*/
public void processMenuKeyEvent(MenuKeyEvent e) {
if (DEBUG) {
System.out.println("in JMenuItem.processMenuKeyEvent for " + getText()+
" " + KeyStroke.getKeyStrokeForEvent(e));
--- 488,498 ----
}
/**
* Handles a keystroke in a menu.
*
! * @param e a {@code MenuKeyEvent} object
*/
public void processMenuKeyEvent(MenuKeyEvent e) {
if (DEBUG) {
System.out.println("in JMenuItem.processMenuKeyEvent for " + getText()+
" " + KeyStroke.getKeyStrokeForEvent(e));
*** 511,521 ****
/**
* Notifies all listeners that have registered interest for
* notification on this event type.
*
! * @param event a <code>MenuMouseDragEvent</code>
* @see EventListenerList
*/
protected void fireMenuDragMouseEntered(MenuDragMouseEvent event) {
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
--- 511,521 ----
/**
* Notifies all listeners that have registered interest for
* notification on this event type.
*
! * @param event a {@code MenuMouseDragEvent}
* @see EventListenerList
*/
protected void fireMenuDragMouseEntered(MenuDragMouseEvent event) {
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
*** 531,541 ****
/**
* Notifies all listeners that have registered interest for
* notification on this event type.
*
! * @param event a <code>MenuDragMouseEvent</code>
* @see EventListenerList
*/
protected void fireMenuDragMouseExited(MenuDragMouseEvent event) {
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
--- 531,541 ----
/**
* Notifies all listeners that have registered interest for
* notification on this event type.
*
! * @param event a {@code MenuDragMouseEvent}
* @see EventListenerList
*/
protected void fireMenuDragMouseExited(MenuDragMouseEvent event) {
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
*** 551,561 ****
/**
* Notifies all listeners that have registered interest for
* notification on this event type.
*
! * @param event a <code>MenuDragMouseEvent</code>
* @see EventListenerList
*/
protected void fireMenuDragMouseDragged(MenuDragMouseEvent event) {
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
--- 551,561 ----
/**
* Notifies all listeners that have registered interest for
* notification on this event type.
*
! * @param event a {@code MenuDragMouseEvent}
* @see EventListenerList
*/
protected void fireMenuDragMouseDragged(MenuDragMouseEvent event) {
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
*** 571,581 ****
/**
* Notifies all listeners that have registered interest for
* notification on this event type.
*
! * @param event a <code>MenuDragMouseEvent</code>
* @see EventListenerList
*/
protected void fireMenuDragMouseReleased(MenuDragMouseEvent event) {
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
--- 571,581 ----
/**
* Notifies all listeners that have registered interest for
* notification on this event type.
*
! * @param event a {@code MenuDragMouseEvent}
* @see EventListenerList
*/
protected void fireMenuDragMouseReleased(MenuDragMouseEvent event) {
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
*** 591,601 ****
/**
* Notifies all listeners that have registered interest for
* notification on this event type.
*
! * @param event a <code>MenuKeyEvent</code>
* @see EventListenerList
*/
protected void fireMenuKeyPressed(MenuKeyEvent event) {
if (DEBUG) {
System.out.println("in JMenuItem.fireMenuKeyPressed for " + getText()+
--- 591,601 ----
/**
* Notifies all listeners that have registered interest for
* notification on this event type.
*
! * @param event a {@code MenuKeyEvent}
* @see EventListenerList
*/
protected void fireMenuKeyPressed(MenuKeyEvent event) {
if (DEBUG) {
System.out.println("in JMenuItem.fireMenuKeyPressed for " + getText()+
*** 615,625 ****
/**
* Notifies all listeners that have registered interest for
* notification on this event type.
*
! * @param event a <code>MenuKeyEvent</code>
* @see EventListenerList
*/
protected void fireMenuKeyReleased(MenuKeyEvent event) {
if (DEBUG) {
System.out.println("in JMenuItem.fireMenuKeyReleased for " + getText()+
--- 615,625 ----
/**
* Notifies all listeners that have registered interest for
* notification on this event type.
*
! * @param event a {@code MenuKeyEvent}
* @see EventListenerList
*/
protected void fireMenuKeyReleased(MenuKeyEvent event) {
if (DEBUG) {
System.out.println("in JMenuItem.fireMenuKeyReleased for " + getText()+
*** 639,649 ****
/**
* Notifies all listeners that have registered interest for
* notification on this event type.
*
! * @param event a <code>MenuKeyEvent</code>
* @see EventListenerList
*/
protected void fireMenuKeyTyped(MenuKeyEvent event) {
if (DEBUG) {
System.out.println("in JMenuItem.fireMenuKeyTyped for " + getText()+
--- 639,649 ----
/**
* Notifies all listeners that have registered interest for
* notification on this event type.
*
! * @param event a {@code MenuKeyEvent}
* @see EventListenerList
*/
protected void fireMenuKeyTyped(MenuKeyEvent event) {
if (DEBUG) {
System.out.println("in JMenuItem.fireMenuKeyTyped for " + getText()+
*** 660,671 ****
}
}
}
/**
! * Called by the <code>MenuSelectionManager</code> when the
! * <code>MenuElement</code> is selected or unselected.
*
* @param isIncluded true if this menu item is on the part of the menu
* path that changed, false if this menu is part of the
* a menu path that changed, but this particular part of
* that path is still the same
--- 660,671 ----
}
}
}
/**
! * Called by the {@code MenuSelectionManager} when the
! * {@code MenuElement} is selected or unselected.
*
* @param isIncluded true if this menu item is on the part of the menu
* path that changed, false if this menu is part of the
* a menu path that changed, but this particular part of
* that path is still the same
*** 677,756 ****
/**
* This method returns an array containing the sub-menu
* components for this menu component.
*
! * @return an array of <code>MenuElement</code>s
*/
public MenuElement[] getSubElements() {
return new MenuElement[0];
}
/**
! * Returns the <code>java.awt.Component</code> used to paint
* this object. The returned component will be used to convert
* events and detect if an event is inside a menu component.
*
! * @return the <code>Component</code> that paints this menu item
*/
public Component getComponent() {
return this;
}
/**
! * Adds a <code>MenuDragMouseListener</code> to the menu item.
*
! * @param l the <code>MenuDragMouseListener</code> to be added
*/
public void addMenuDragMouseListener(MenuDragMouseListener l) {
listenerList.add(MenuDragMouseListener.class, l);
}
/**
! * Removes a <code>MenuDragMouseListener</code> from the menu item.
*
! * @param l the <code>MenuDragMouseListener</code> to be removed
*/
public void removeMenuDragMouseListener(MenuDragMouseListener l) {
listenerList.remove(MenuDragMouseListener.class, l);
}
/**
! * Returns an array of all the <code>MenuDragMouseListener</code>s added
* to this JMenuItem with addMenuDragMouseListener().
*
! * @return all of the <code>MenuDragMouseListener</code>s added or an empty
* array if no listeners have been added
* @since 1.4
*/
public MenuDragMouseListener[] getMenuDragMouseListeners() {
return listenerList.getListeners(MenuDragMouseListener.class);
}
/**
! * Adds a <code>MenuKeyListener</code> to the menu item.
*
! * @param l the <code>MenuKeyListener</code> to be added
*/
public void addMenuKeyListener(MenuKeyListener l) {
listenerList.add(MenuKeyListener.class, l);
}
/**
! * Removes a <code>MenuKeyListener</code> from the menu item.
*
! * @param l the <code>MenuKeyListener</code> to be removed
*/
public void removeMenuKeyListener(MenuKeyListener l) {
listenerList.remove(MenuKeyListener.class, l);
}
/**
! * Returns an array of all the <code>MenuKeyListener</code>s added
* to this JMenuItem with addMenuKeyListener().
*
! * @return all of the <code>MenuKeyListener</code>s added or an empty
* array if no listeners have been added
* @since 1.4
*/
public MenuKeyListener[] getMenuKeyListeners() {
return listenerList.getListeners(MenuKeyListener.class);
--- 677,756 ----
/**
* This method returns an array containing the sub-menu
* components for this menu component.
*
! * @return an array of {@code MenuElement}s
*/
public MenuElement[] getSubElements() {
return new MenuElement[0];
}
/**
! * Returns the {@code java.awt.Component} used to paint
* this object. The returned component will be used to convert
* events and detect if an event is inside a menu component.
*
! * @return the {@code Component} that paints this menu item
*/
public Component getComponent() {
return this;
}
/**
! * Adds a {@code MenuDragMouseListener} to the menu item.
*
! * @param l the {@code MenuDragMouseListener} to be added
*/
public void addMenuDragMouseListener(MenuDragMouseListener l) {
listenerList.add(MenuDragMouseListener.class, l);
}
/**
! * Removes a {@code MenuDragMouseListener} from the menu item.
*
! * @param l the {@code MenuDragMouseListener} to be removed
*/
public void removeMenuDragMouseListener(MenuDragMouseListener l) {
listenerList.remove(MenuDragMouseListener.class, l);
}
/**
! * Returns an array of all the {@code MenuDragMouseListener}s added
* to this JMenuItem with addMenuDragMouseListener().
*
! * @return all of the {@code MenuDragMouseListener}s added or an empty
* array if no listeners have been added
* @since 1.4
*/
public MenuDragMouseListener[] getMenuDragMouseListeners() {
return listenerList.getListeners(MenuDragMouseListener.class);
}
/**
! * Adds a {@code MenuKeyListener} to the menu item.
*
! * @param l the {@code MenuKeyListener} to be added
*/
public void addMenuKeyListener(MenuKeyListener l) {
listenerList.add(MenuKeyListener.class, l);
}
/**
! * Removes a {@code MenuKeyListener} from the menu item.
*
! * @param l the {@code MenuKeyListener} to be removed
*/
public void removeMenuKeyListener(MenuKeyListener l) {
listenerList.remove(MenuKeyListener.class, l);
}
/**
! * Returns an array of all the {@code MenuKeyListener}s added
* to this JMenuItem with addMenuKeyListener().
*
! * @return all of the {@code MenuKeyListener}s added or an empty
* array if no listeners have been added
* @since 1.4
*/
public MenuKeyListener[] getMenuKeyListeners() {
return listenerList.getListeners(MenuKeyListener.class);
*** 780,814 ****
}
}
/**
! * Returns a string representation of this <code>JMenuItem</code>.
* This method is intended to be used only for debugging purposes,
* and the content and format of the returned string may vary between
* implementations. The returned string may be empty but may not
! * be <code>null</code>.
*
! * @return a string representation of this <code>JMenuItem</code>
*/
protected String paramString() {
return super.paramString();
}
/////////////////
// Accessibility support
////////////////
/**
! * Returns the <code>AccessibleContext</code> associated with this
! * <code>JMenuItem</code>. For <code>JMenuItem</code>s,
! * the <code>AccessibleContext</code> takes the form of an
! * <code>AccessibleJMenuItem</code>.
* A new AccessibleJMenuItme instance is created if necessary.
*
! * @return an <code>AccessibleJMenuItem</code> that serves as the
! * <code>AccessibleContext</code> of this <code>JMenuItem</code>
*/
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJMenuItem();
}
--- 780,814 ----
}
}
/**
! * Returns a string representation of this {@code JMenuItem}.
* This method is intended to be used only for debugging purposes,
* and the content and format of the returned string may vary between
* implementations. The returned string may be empty but may not
! * be {@code null}.
*
! * @return a string representation of this {@code JMenuItem}
*/
protected String paramString() {
return super.paramString();
}
/////////////////
// Accessibility support
////////////////
/**
! * Returns the {@code AccessibleContext} associated with this
! * {@code JMenuItem}. For {@code JMenuItem}s,
! * the {@code AccessibleContext} takes the form of an
! * {@code AccessibleJMenuItem}.
* A new AccessibleJMenuItme instance is created if necessary.
*
! * @return an {@code AccessibleJMenuItem} that serves as the
! * {@code AccessibleContext} of this {@code JMenuItem}
*/
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJMenuItem();
}
*** 816,836 ****
}
/**
* This class implements accessibility support for the
! * <code>JMenuItem</code> class. It provides an implementation of the
* Java Accessibility API appropriate to menu item user-interface
* elements.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
@SuppressWarnings("serial")
protected class AccessibleJMenuItem extends AccessibleAbstractButton implements ChangeListener {
--- 816,836 ----
}
/**
* This class implements accessibility support for the
! * {@code JMenuItem} class. It provides an implementation of the
* Java Accessibility API appropriate to menu item user-interface
* elements.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*/
@SuppressWarnings("serial")
protected class AccessibleJMenuItem extends AccessibleAbstractButton implements ChangeListener {
< prev index next >