aboutsummaryrefslogtreecommitdiff
path: root/libjava/javax/swing/JMenu.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/javax/swing/JMenu.java')
-rw-r--r--libjava/javax/swing/JMenu.java36
1 files changed, 16 insertions, 20 deletions
diff --git a/libjava/javax/swing/JMenu.java b/libjava/javax/swing/JMenu.java
index b96ed604020..9a9289f0bc1 100644
--- a/libjava/javax/swing/JMenu.java
+++ b/libjava/javax/swing/JMenu.java
@@ -1,5 +1,5 @@
/* JMenu.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -77,9 +77,6 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
{
private static final long serialVersionUID = 4227225638931828014L;
- /** name for the UI delegate for this menu. */
- private static final String uiClassID = "MenuUI";
-
/** A Popup menu associated with this menu, which pops up when menu is selected */
private JPopupMenu popupMenu = new JPopupMenu();
@@ -107,30 +104,32 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
}
/**
- * Creates a new JMenu with the spicified label
+ * Creates a new <code>JMenu</code> with the specified label.
*
* @param text label for this menu
*/
public JMenu(String text)
{
super(text);
+ popupMenu.setInvoker(this);
}
/**
- * Creates a new JMenu object
+ * Creates a new <code>JMenu</code> object.
*
- * @param action Action that is used to create menu item tha will be
+ * @param action Action that is used to create menu item tha will be
* added to the menu.
*/
public JMenu(Action action)
{
super(action);
createActionChangeListener(this);
+ popupMenu.setInvoker(this);
}
/**
- * Creates a new JMenu with specified label and an option
- * for this menu to be tear-off menu
+ * Creates a new <code>JMenu</code> with specified label and an option
+ * for this menu to be tear-off menu.
*
* @param text label for this menu
* @param tearoff true if this menu should be tear-off and false otherwise
@@ -312,7 +311,7 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
*/
public String getUIClassID()
{
- return uiClassID;
+ return "MenuUI";
}
/**
@@ -388,8 +387,8 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
/**
* Checks if PopupMenu associated with this menu is visible
*
- * @return true if the popup associated with this menu is currently visible on the screen and
- * false otherwise.
+ * @return true if the popup associated with this menu is currently visible
+ * on the screen and false otherwise.
*/
public boolean isPopupMenuVisible()
{
@@ -528,15 +527,15 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
}
/**
- * Returns number of items in the menu
+ * Returns number of items in the menu including separators.
*
* @return number of items in the menu
+ *
+ * @see #getMenuComponentCount()
*/
public int getItemCount()
{
- // returns the number of items on
- // the menu, including separators.
- return getComponents().length;
+ return getMenuComponentCount();
}
/**
@@ -592,10 +591,7 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
*/
public boolean isTopLevelMenu()
{
- if (getParent() instanceof JMenuBar)
- return true;
- else
- return false;
+ return getParent() instanceof JMenuBar;
}
/**