diff options
Diffstat (limited to 'libjava/classpath/java/awt/Canvas.java')
-rw-r--r-- | libjava/classpath/java/awt/Canvas.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libjava/classpath/java/awt/Canvas.java b/libjava/classpath/java/awt/Canvas.java index b599582ba93..843fded44db 100644 --- a/libjava/classpath/java/awt/Canvas.java +++ b/libjava/classpath/java/awt/Canvas.java @@ -68,6 +68,11 @@ public class Canvas * Compatible with Sun's JDK. */ private static final long serialVersionUID = -2284879212465893870L; + + /** + * The number used to generate the name returned by getName. + */ + private static transient long next_canvas_number; /** * The graphics configuration associated with the canvas. @@ -343,4 +348,19 @@ public class Canvas /* Call the paint method */ paint(graphics); } + + /** + * Generate a unique name for this <code>Canvas</code>. + * + * @return A unique name for this <code>Canvas</code>. + */ + String generateName() + { + return "canvas" + getUniqueLong(); + } + + private static synchronized long getUniqueLong() + { + return next_canvas_number++; + } } |