< prev index next >

src/java.desktop/share/classes/java/awt/Menu.java

Print this page

        

*** 32,56 **** import java.awt.event.KeyEvent; import javax.accessibility.*; import sun.awt.AWTAccessor; /** ! * A <code>Menu</code> object is a pull-down menu component * that is deployed from a menu bar. * <p> * A menu can optionally be a <i>tear-off</i> menu. A tear-off menu * can be opened and dragged away from its parent menu bar or menu. * It remains on the screen after the mouse button has been released. * The mechanism for tearing off a menu is platform dependent, since * the look and feel of the tear-off menu is determined by its peer. * On platforms that do not support tear-off menus, the tear-off * property is ignored. * <p> ! * Each item in a menu must belong to the <code>MenuItem</code> ! * class. It can be an instance of <code>MenuItem</code>, a submenu ! * (an instance of <code>Menu</code>), or a check box (an instance of ! * <code>CheckboxMenuItem</code>). * * @author Sami Shaio * @see java.awt.MenuItem * @see java.awt.CheckboxMenuItem * @since 1.0 --- 32,56 ---- import java.awt.event.KeyEvent; import javax.accessibility.*; import sun.awt.AWTAccessor; /** ! * A {@code Menu} object is a pull-down menu component * that is deployed from a menu bar. * <p> * A menu can optionally be a <i>tear-off</i> menu. A tear-off menu * can be opened and dragged away from its parent menu bar or menu. * It remains on the screen after the mouse button has been released. * The mechanism for tearing off a menu is platform dependent, since * the look and feel of the tear-off menu is determined by its peer. * On platforms that do not support tear-off menus, the tear-off * property is ignored. * <p> ! * Each item in a menu must belong to the {@code MenuItem} ! * class. It can be an instance of {@code MenuItem}, a submenu ! * (an instance of {@code Menu}), or a check box (an instance of ! * {@code CheckboxMenuItem}). * * @author Sami Shaio * @see java.awt.MenuItem * @see java.awt.CheckboxMenuItem * @since 1.0
*** 81,106 **** Vector<MenuItem> items = new Vector<>(); /** * This field indicates whether the menu has the * tear of property or not. It will be set to ! * <code>true</code> if the menu has the tear off ! * property and it will be set to <code>false</code> * if it does not. * A torn off menu can be deleted by a user when * it is no longer needed. * * @serial * @see #isTearOff() */ boolean tearOff; /** ! * This field will be set to <code>true</code> * if the Menu in question is actually a help ! * menu. Otherwise it will be set to <code> ! * false</code>. * * @serial */ boolean isHelpMenu; --- 81,106 ---- Vector<MenuItem> items = new Vector<>(); /** * This field indicates whether the menu has the * tear of property or not. It will be set to ! * {@code true} if the menu has the tear off ! * property and it will be set to {@code false} * if it does not. * A torn off menu can be deleted by a user when * it is no longer needed. * * @serial * @see #isTearOff() */ boolean tearOff; /** ! * This field will be set to {@code true} * if the Menu in question is actually a help ! * menu. Otherwise it will be set to ! * {@code false}. * * @serial */ boolean isHelpMenu;
*** 144,154 **** * Tear-off functionality may not be supported by all * implementations of AWT. If a particular implementation doesn't * support tear-off menus, this value is silently ignored. * @param label the menu's label in the menu bar, or in * another menu of which this menu is a submenu. ! * @param tearOff if <code>true</code>, the menu * is a tear-off menu. * @exception HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ --- 144,154 ---- * Tear-off functionality may not be supported by all * implementations of AWT. If a particular implementation doesn't * support tear-off menus, this value is silently ignored. * @param label the menu's label in the menu bar, or in * another menu of which this menu is a submenu. ! * @param tearOff if {@code true}, the menu * is a tear-off menu. * @exception HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */
*** 202,213 **** * Indicates whether this menu is a tear-off menu. * <p> * Tear-off functionality may not be supported by all * implementations of AWT. If a particular implementation doesn't * support tear-off menus, this value is silently ignored. ! * @return <code>true</code> if this is a tear-off menu; ! * <code>false</code> otherwise. */ public boolean isTearOff() { return tearOff; } --- 202,213 ---- * Indicates whether this menu is a tear-off menu. * <p> * Tear-off functionality may not be supported by all * implementations of AWT. If a particular implementation doesn't * support tear-off menus, this value is silently ignored. ! * @return {@code true} if this is a tear-off menu; ! * {@code false} otherwise. */ public boolean isTearOff() { return tearOff; }
*** 223,233 **** /** * Returns the number of items in this menu. * * @return the number of items in this menu * @deprecated As of JDK version 1.1, ! * replaced by <code>getItemCount()</code>. */ @Deprecated public int countItems() { return countItemsImpl(); } --- 223,233 ---- /** * Returns the number of items in this menu. * * @return the number of items in this menu * @deprecated As of JDK version 1.1, ! * replaced by {@code getItemCount()}. */ @Deprecated public int countItems() { return countItemsImpl(); }
*** 302,312 **** * @param index the position at which the menu * item should be inserted. * @see java.awt.Menu#add(java.lang.String) * @see java.awt.Menu#add(java.awt.MenuItem) * @exception IllegalArgumentException if the value of ! * <code>index</code> is less than zero * @since 1.1 */ public void insert(MenuItem menuitem, int index) { synchronized (getTreeLock()) { --- 302,312 ---- * @param index the position at which the menu * item should be inserted. * @see java.awt.Menu#add(java.lang.String) * @see java.awt.Menu#add(java.awt.MenuItem) * @exception IllegalArgumentException if the value of ! * {@code index} is less than zero * @since 1.1 */ public void insert(MenuItem menuitem, int index) { synchronized (getTreeLock()) {
*** 338,356 **** } /** * Inserts a menu item with the specified label into this menu * at the specified position. This is a convenience method for ! * <code>insert(menuItem, index)</code>. * * @param label the text on the item * @param index the position at which the menu item * should be inserted * @see java.awt.Menu#add(java.lang.String) * @see java.awt.Menu#add(java.awt.MenuItem) * @exception IllegalArgumentException if the value of ! * <code>index</code> is less than zero * @since 1.1 */ public void insert(String label, int index) { insert(new MenuItem(label), index); --- 338,356 ---- } /** * Inserts a menu item with the specified label into this menu * at the specified position. This is a convenience method for ! * {@code insert(menuItem, index)}. * * @param label the text on the item * @param index the position at which the menu item * should be inserted * @see java.awt.Menu#add(java.lang.String) * @see java.awt.Menu#add(java.awt.MenuItem) * @exception IllegalArgumentException if the value of ! * {@code index} is less than zero * @since 1.1 */ public void insert(String label, int index) { insert(new MenuItem(label), index);
*** 367,377 **** /** * Inserts a separator at the specified position. * @param index the position at which the * menu separator should be inserted. * @exception IllegalArgumentException if the value of ! * <code>index</code> is less than 0. * @see java.awt.Menu#addSeparator * @since 1.1 */ public void insertSeparator(int index) { --- 367,377 ---- /** * Inserts a separator at the specified position. * @param index the position at which the * menu separator should be inserted. * @exception IllegalArgumentException if the value of ! * {@code index} is less than 0. * @see java.awt.Menu#addSeparator * @since 1.1 */ public void insertSeparator(int index) {
*** 421,431 **** } /** * Removes the specified menu item from this menu. * @param item the item to be removed from the menu. ! * If <code>item</code> is <code>null</code> * or is not in this menu, this method does * nothing. */ public void remove(MenuComponent item) { synchronized (getTreeLock()) { --- 421,431 ---- } /** * Removes the specified menu item from this menu. * @param item the item to be removed from the menu. ! * If {@code item} is {@code null} * or is not in this menu, this method does * nothing. */ public void remove(MenuComponent item) { synchronized (getTreeLock()) {
*** 517,544 **** private int menuSerializedDataVersion = 1; /** * Writes default serializable fields to stream. * ! * @param s the <code>ObjectOutputStream</code> to write * @see AWTEventMulticaster#save(ObjectOutputStream, String, EventListener) * @see #readObject(ObjectInputStream) */ private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException { s.defaultWriteObject(); } /** ! * Reads the <code>ObjectInputStream</code>. * Unrecognized keys or values will be ignored. * ! * @param s the <code>ObjectInputStream</code> to read * @exception HeadlessException if ! * <code>GraphicsEnvironment.isHeadless</code> returns ! * <code>true</code> * @see java.awt.GraphicsEnvironment#isHeadless * @see #writeObject(ObjectOutputStream) */ private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException, HeadlessException --- 517,544 ---- private int menuSerializedDataVersion = 1; /** * Writes default serializable fields to stream. * ! * @param s the {@code ObjectOutputStream} to write * @see AWTEventMulticaster#save(ObjectOutputStream, String, EventListener) * @see #readObject(ObjectInputStream) */ private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException { s.defaultWriteObject(); } /** ! * Reads the {@code ObjectInputStream}. * Unrecognized keys or values will be ignored. * ! * @param s the {@code ObjectInputStream} to read * @exception HeadlessException if ! * {@code GraphicsEnvironment.isHeadless} returns ! * {@code true} * @see java.awt.GraphicsEnvironment#isHeadless * @see #writeObject(ObjectOutputStream) */ private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException, HeadlessException
*** 550,564 **** item.parent = this; } } /** ! * Returns a string representing the state of this <code>Menu</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 the parameter string of this menu */ public String paramString() { String str = ",tearOff=" + tearOff+",isHelpMenu=" + isHelpMenu; --- 550,564 ---- item.parent = this; } } /** ! * Returns a string representing the state of this {@code Menu}. * 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 the parameter string of this menu */ public String paramString() { String str = ",tearOff=" + tearOff+",isHelpMenu=" + isHelpMenu;
*** 604,614 **** * accessibility. This class is not meant to be used directly by * application developers, but is instead meant only to be * subclassed by menu component developers. * <p> * This class implements accessibility support for the ! * <code>Menu</code> class. It provides an implementation of the * Java Accessibility API appropriate to menu user-interface elements. * @since 1.3 */ protected class AccessibleAWTMenu extends AccessibleAWTMenuItem { --- 604,614 ---- * accessibility. This class is not meant to be used directly by * application developers, but is instead meant only to be * subclassed by menu component developers. * <p> * This class implements accessibility support for the ! * {@code Menu} class. It provides an implementation of the * Java Accessibility API appropriate to menu user-interface elements. * @since 1.3 */ protected class AccessibleAWTMenu extends AccessibleAWTMenuItem {
< prev index next >