2005-02-21 Michael Koch <konqueror@gmx.de>
authorMichael Koch <konqueror@gmx.de>
Mon, 21 Feb 2005 21:41:28 +0000 (21:41 +0000)
committerMichael Koch <mkoch@gcc.gnu.org>
Mon, 21 Feb 2005 21:41:28 +0000 (21:41 +0000)
* java/awt/Checkbox.java
(next_checkbox_number): New static variable.
(generateName): New method.
(getUniqueLong): Likewise.
* java/awt/Window.java
(next_window_number): New static variable.
(generateName): New method.
(getUniqueLong): Likewise.

From-SVN: r95354

libjava/ChangeLog
libjava/java/awt/Checkbox.java
libjava/java/awt/Window.java

index 1c141df39057b2326091432dab1ae8e0a0425d9c..a9025c304c4d03c98e4aa347eb047a981f52137b 100644 (file)
@@ -1,3 +1,14 @@
+2005-02-21  Michael Koch  <konqueror@gmx.de>
+
+       * java/awt/Checkbox.java
+       (next_checkbox_number): New static variable.
+       (generateName): New method.
+       (getUniqueLong): Likewise.
+       * java/awt/Window.java
+       (next_window_number): New static variable.
+       (generateName): New method.
+       (getUniqueLong): Likewise.
+
 2005-02-21  Mark Wielaard  <mark@klomp.org>
 
        * java/util/jar/JarFile.java (verifyHashes): Check whether ZipEntry
index b3fc4c24d0afb426037cddeeba9fabded764b17a..2a8b62afd0568ba8815415e471c97ef11f14d8f0 100644 (file)
@@ -1,5 +1,5 @@
 /* Checkbox.java -- An AWT checkbox widget
-   Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2002, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -95,6 +95,11 @@ private boolean state;
 // The list of listeners for this object.
 private transient ItemListener item_listeners;
 
+  /*
+   * The number used to generate the name returned by getName.
+   */
+  private static transient long next_checkbox_number;
+
 /**
  * This class provides accessibility support for the
  * checkbox.
@@ -106,7 +111,6 @@ protected class AccessibleAWTCheckbox
   extends AccessibleAWTComponent
   implements ItemListener, AccessibleAction, AccessibleValue
 {
-
   /**
    * Serialization constant to match JDK 1.5
    */
@@ -627,4 +631,18 @@ public AccessibleContext getAccessibleContext()
   return accessibleContext;
 }
 
-} // class Checkbox 
+  /**
+   * Generate a unique name for this checkbox.
+   *
+   * @return A unique name for this checkbox.
+   */
+  String generateName()
+  {
+    return "checkbox" + getUniqueLong();
+  }
+
+  private static synchronized long getUniqueLong()
+  {
+    return next_checkbox_number++;
+  }
+}
index cdcd1a4bf2509b3e79be5dc598e6f2e3d8f5c68f..0a39d20b1ffa165320436a84e504fdd8ec4277ed 100644 (file)
@@ -92,6 +92,11 @@ public class Window extends Container implements Accessible
 
   private transient Component windowFocusOwner;
   
+  /*
+   * The number used to generate the name returned by getName.
+   */
+  private static transient long next_window_number;
+
   protected class AccessibleAWTWindow extends AccessibleAWTContainer
   {
     public AccessibleRole getAccessibleRole()
@@ -945,4 +950,19 @@ public class Window extends Container implements Accessible
         getToolkit().getSystemEventQueue().postEvent(ce);
       }
   }
+
+  /**
+   * Generate a unique name for this window.
+   *
+   * @return A unique name for this window.
+   */
+  String generateName()
+  {
+    return "win" + getUniqueLong();
+  }
+
+  private static synchronized long getUniqueLong()
+  {
+    return next_window_number++;
+  }
 }