< prev index next >

src/java.desktop/share/classes/javax/swing/JMenuBar.java

Print this page

        

@@ -45,14 +45,14 @@
 import javax.swing.border.Border;
 import javax.swing.plaf.*;
 import javax.accessibility.*;
 
 /**
- * An implementation of a menu bar. You add <code>JMenu</code> objects to the
- * menu bar to construct a menu. When the user selects a <code>JMenu</code>
- * object, its associated <code>JPopupMenu</code> is displayed, allowing the
- * user to select one of the <code>JMenuItems</code> on it.
+ * An implementation of a menu bar. You add {@code JMenu} objects to the
+ * menu bar to construct a menu. When the user selects a {@code JMenu}
+ * object, its associated {@code JPopupMenu} is displayed, allowing the
+ * user to select one of the {@code JMenuItems} on it.
  * <p>
  * For information and examples of using menu bars see
  * <a
  href="http://docs.oracle.com/javase/tutorial/uiswing/components/menu.html">How to Use Menus</a>,
  * a section in <em>The Java Tutorial.</em>

@@ -66,19 +66,19 @@
  * 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&trade;
- * has been added to the <code>java.beans</code> package.
+ * has been added to the {@code java.beans} package.
  * Please see {@link java.beans.XMLEncoder}.
  * <p>
  * <strong>Warning:</strong>
- * By default, pressing the Tab key does not transfer focus from a <code>
- * JMenuBar</code> which is added to a container together with other Swing
- * components, because the <code>focusTraversalKeysEnabled</code> property
- * of <code>JMenuBar</code> is set to <code>false</code>. To resolve this,
- * you should call the <code>JMenuBar.setFocusTraversalKeysEnabled(true)</code>
+ * By default, pressing the Tab key does not transfer focus from a
+ * {@code JMenuBar} which is added to a container together with other Swing
+ * components, because the {@code focusTraversalKeysEnabled} property
+ * of {@code JMenuBar} is set to {@code false}. To resolve this,
+ * you should call the {@code JMenuBar.setFocusTraversalKeysEnabled(true)}
  * method.
  * @beaninfo
  *   attribute: isContainer true
  * description: A container for holding and displaying menus.
  *

@@ -170,21 +170,21 @@
 
 
     /**
      * Returns the model object that handles single selections.
      *
-     * @return the <code>SingleSelectionModel</code> property
+     * @return the {@code SingleSelectionModel} property
      * @see SingleSelectionModel
      */
     public SingleSelectionModel getSelectionModel() {
         return selectionModel;
     }
 
     /**
      * Sets the model object to handle single selections.
      *
-     * @param model the <code>SingleSelectionModel</code> to use
+     * @param model the {@code SingleSelectionModel} to use
      * @see SingleSelectionModel
      * @beaninfo
      *       bound: true
      * description: The selection model, recording which child is selected.
      */

@@ -196,11 +196,11 @@
 
 
     /**
      * Appends the specified menu to the end of the menu bar.
      *
-     * @param c the <code>JMenu</code> component to add
+     * @param c the {@code JMenu} component to add
      * @return the menu component
      */
     public JMenu add(JMenu c) {
         super.add(c);
         return c;

@@ -209,13 +209,13 @@
     /**
      * Returns the menu at the specified position in the menu bar.
      *
      * @param index  an integer giving the position in the menu bar, where
      *               0 is the first position
-     * @return the <code>JMenu</code> at that position, or <code>null</code> if
-     *          if there is no <code>JMenu</code> at that position (ie. if
-     *          it is a <code>JMenuItem</code>)
+     * @return the {@code JMenu} at that position, or {@code null} if
+     *          if there is no {@code JMenu} at that position (ie. if
+     *          it is a {@code JMenuItem})
      */
     public JMenu getMenu(int index) {
         Component c = getComponentAtIndex(index);
         if (c instanceof JMenu)
             return (JMenu) c;

@@ -244,24 +244,24 @@
 
     /**
      * Gets the help menu for the menu bar.  This method is not yet
      * implemented and will throw an exception.
      *
-     * @return the <code>JMenu</code> that delivers help to the user
+     * @return the {@code JMenu} that delivers help to the user
      */
     @Transient
     public JMenu getHelpMenu() {
         throw new Error("getHelpMenu() not yet implemented.");
     }
 
     /**
      * Returns the component at the specified index.
      *
      * @param i an integer specifying the position, where 0 is first
-     * @return the <code>Component</code> at the position,
-     *          or <code>null</code> for an invalid index
-     * @deprecated replaced by <code>getComponent(int i)</code>
+     * @return the {@code Component} at the position,
+     *          or {@code null} for an invalid index
+     * @deprecated replaced by {@code getComponent(int i)}
      */
     @Deprecated
     public Component getComponentAtIndex(int i) {
         if(i < 0 || i >= getComponentCount()) {
             return null;

@@ -270,11 +270,11 @@
     }
 
     /**
      * Returns the index of the specified component.
      *
-     * @param c  the <code>Component</code> to find
+     * @param c  the {@code Component} to find
      * @return an integer giving the component's position, where 0 is first;
      *          or -1 if it can't be found
      */
     public int getComponentIndex(Component c) {
         int ncomponents = this.getComponentCount();

@@ -289,11 +289,11 @@
 
     /**
      * Sets the currently selected component, producing a
      * a change to the selection model.
      *
-     * @param sel the <code>Component</code> to select
+     * @param sel the {@code Component} to select
      */
     public void setSelected(Component sel) {
         SingleSelectionModel model = getSelectionModel();
         int index = getComponentIndex(sel);
         model.setSelectedIndex(index);

@@ -318,11 +318,11 @@
     }
 
     /**
      * Sets whether the border should be painted.
      *
-     * @param b if true and border property is not <code>null</code>,
+     * @param b if true and border property is not {@code null},
      *          the border is painted.
      * @see #isBorderPainted
      * @beaninfo
      *        bound: true
      *    attribute: visualUpdate true

@@ -337,14 +337,14 @@
             repaint();
         }
     }
 
     /**
-     * Paints the menubar's border if <code>BorderPainted</code>
+     * Paints the menubar's border if {@code BorderPainted}
      * property is true.
      *
-     * @param g the <code>Graphics</code> context to use for painting
+     * @param g the {@code Graphics} context to use for painting
      * @see JComponent#paint
      * @see JComponent#setBorder
      */
     protected void paintBorder(Graphics g) {
         if (isBorderPainted()) {

@@ -352,11 +352,11 @@
         }
     }
 
     /**
      * Sets the margin between the menubar's border and
-     * its menus. Setting to <code>null</code> will cause the menubar to
+     * its menus. Setting to {@code null} will cause the menubar to
      * use the default margins.
      *
      * @param m an Insets object containing the margin values
      * @see Insets
      * @beaninfo

@@ -377,11 +377,11 @@
     /**
      * Returns the margin between the menubar's border and
      * its menus.  If there is no previous margin, it will create
      * a default margin with zero size.
      *
-     * @return an <code>Insets</code> object containing the margin values
+     * @return an {@code Insets} object containing the margin values
      * @see Insets
      */
     public Insets getMargin() {
         if(margin == null) {
             return new Insets(0,0,0,0);

@@ -390,37 +390,37 @@
         }
     }
 
 
     /**
-     * Implemented to be a <code>MenuElement</code> -- does nothing.
+     * Implemented to be a {@code MenuElement} -- does nothing.
      *
      * @see #getSubElements
      */
     public void processMouseEvent(MouseEvent event,MenuElement path[],MenuSelectionManager manager) {
     }
 
     /**
-     * Implemented to be a <code>MenuElement</code> -- does nothing.
+     * Implemented to be a {@code MenuElement} -- does nothing.
      *
      * @see #getSubElements
      */
     public void processKeyEvent(KeyEvent e,MenuElement path[],MenuSelectionManager manager) {
     }
 
     /**
-     * Implemented to be a <code>MenuElement</code> -- does nothing.
+     * Implemented to be a {@code MenuElement} -- does nothing.
      *
      * @see #getSubElements
      */
     public void menuSelectionChanged(boolean isIncluded) {
     }
 
     /**
-     * Implemented to be a <code>MenuElement</code> -- returns the
+     * Implemented to be a {@code MenuElement} -- returns the
      * menus in this menu bar.
-     * This is the reason for implementing the <code>MenuElement</code>
+     * This is the reason for implementing the {@code MenuElement}
      * interface -- so that the menu bar can be treated the same as
      * other menu elements.
      * @return an array of menu items in the menu bar.
      */
     public MenuElement[] getSubElements() {

@@ -441,29 +441,29 @@
             result[i] = tmp.elementAt(i);
         return result;
     }
 
     /**
-     * Implemented to be a <code>MenuElement</code>. Returns this object.
+     * Implemented to be a {@code MenuElement}. Returns this object.
      *
-     * @return the current <code>Component</code> (this)
+     * @return the current {@code Component} (this)
      * @see #getSubElements
      */
     public Component getComponent() {
         return this;
     }
 
 
     /**
-     * Returns a string representation of this <code>JMenuBar</code>.
+     * Returns a string representation of this {@code JMenuBar}.
      * 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>.
+     * be {@code null}.
      *
-     * @return  a string representation of this <code>JMenuBar</code>
+     * @return  a string representation of this {@code JMenuBar}
      */
     protected String paramString() {
         String paintBorderString = (paintBorder ?
                                     "true" : "false");
         String marginString = (margin != null ?

@@ -494,21 +494,21 @@
         return accessibleContext;
     }
 
     /**
      * This class implements accessibility support for the
-     * <code>JMenuBar</code> class.  It provides an implementation of the
+     * {@code JMenuBar} class.  It provides an implementation of the
      * Java Accessibility API appropriate to menu bar 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&trade;
-     * has been added to the <code>java.beans</code> package.
+     * has been added to the {@code java.beans} package.
      * Please see {@link java.beans.XMLEncoder}.
      */
     @SuppressWarnings("serial")
     protected class AccessibleJMenuBar extends AccessibleJComponent
         implements AccessibleSelection {

@@ -713,20 +713,20 @@
         }
         return false;
     }
 
     /**
-     * Overrides <code>JComponent.addNotify</code> to register this
+     * Overrides {@code JComponent.addNotify} to register this
      * menu bar with the current keyboard manager.
      */
     public void addNotify() {
         super.addNotify();
         KeyboardManager.getCurrentManager().registerMenuBar(this);
     }
 
     /**
-     * Overrides <code>JComponent.removeNotify</code> to unregister this
+     * Overrides {@code JComponent.removeNotify} to unregister this
      * menu bar with the current keyboard manager.
      */
     public void removeNotify() {
         super.removeNotify();
         KeyboardManager.getCurrentManager().unregisterMenuBar(this);
< prev index next >