OSDN Git Service

2006-08-14 Mark Wielaard <mark@klomp.org>
[pf3gnuchains/gcc-fork.git] / libjava / classpath / java / awt / MenuBar.java
index 3c6b915..bd658cd 100644 (file)
@@ -60,10 +60,15 @@ public class MenuBar extends MenuComponent
   implements MenuContainer, Serializable, Accessible
 {
 
-//Serialization Constant
+  // Serialization Constant
   private static final long serialVersionUID = -4930327919388951260L;
 
   /**
+   * The number used to generate the name returned by getName.
+   */
+  private static transient long next_menubar_number;
+  
+  /**
    * @serial The menu used for providing help information
    */
   private Menu helpMenu;
@@ -331,6 +336,21 @@ public class MenuBar extends MenuComponent
       accessibleContext = new AccessibleAWTMenuBar();
     return accessibleContext;
   }
+  
+  /**
+   * Generate a unique name for this <code>MenuBar</code>.
+   *
+   * @return A unique name for this <code>MenuBar</code>.
+   */
+  String generateName()
+  {
+    return "menubar" + getUniqueLong();
+  }
+
+  private static synchronized long getUniqueLong()
+  {
+    return next_menubar_number++;
+  }
 
   /**
    * This class provides accessibility support for AWT menu bars.