Hey,

This patch fixes a couple of bugs in java.awt.Dialog and
java.awt.FileDialog.  I have commited a mauve test for these changes.

Cheers,
Tania

2006-10-25  Tania Bento  <[EMAIL PROTECTED]>

        * java/awt/Dialog.java: Created new private variable
        next_dialog_number.
        (Dialog(Frame, String, boolean, GraphicsConfiguration)):
        Set cursor to default cursor.
        (Dialog(Dialog, STring, boolean, GraphicsConfiguration)):
        Same.
        (generateName): New method.
        (getUniqueLong): New private method.
        * java/awt/FileDialog.java: Created new private variable
        next_file_dialog_number.
        (setFile): If file == "", set it to null.
        (generateName): New method.
        (getUniqueLong): New private method.

Index: java/awt/Dialog.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Dialog.java,v
retrieving revision 1.28
diff -u -r1.28 Dialog.java
--- java/awt/Dialog.java	8 Apr 2006 12:51:11 -0000	1.28
+++ java/awt/Dialog.java	25 Oct 2006 20:47:17 -0000
@@ -97,6 +97,11 @@
   private EventQueue eq2 = null;
 
   /**
+   * The number used to generate the name returned by getName.
+   */
+  private static transient long next_dialog_number;
+
+  /**
    * Initializes a new instance of <code>Dialog</code> with the specified
    * parent, that is resizable and not modal, and which has no title.
    * 
@@ -190,6 +195,7 @@
     visible = false;
 
     setLayout(new BorderLayout());
+    setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
   }
 
   /**
@@ -273,6 +279,7 @@
     visible = false;
 
     setLayout(new BorderLayout());
+    setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
   }
 
   /**
@@ -530,5 +537,19 @@
       accessibleContext = new AccessibleAWTDialog();
     return accessibleContext;
   }
+  
+  /**
+   * Generate a unique name for this <code>Dialog</code>.
+   *
+   * @return A unique name for this <code>Dialog</code>.
+   */
+  String generateName()
+  {
+    return "dialog" + getUniqueLong();
+  }
 
+  private static synchronized long getUniqueLong()
+  {
+    return next_dialog_number++;
+  }
 }
Index: java/awt/FileDialog.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/FileDialog.java,v
retrieving revision 1.16
diff -u -r1.16 FileDialog.java
--- java/awt/FileDialog.java	16 Jun 2006 16:10:22 -0000	1.16
+++ java/awt/FileDialog.java	25 Oct 2006 20:47:17 -0000
@@ -95,6 +95,11 @@
   */
 private int mode;
 
+/**
+ * The number used to generate the name returned by getName.
+ */
+private static transient long next_file_dialog_number;
+
 /*************************************************************************/
 
 /*
@@ -300,7 +305,11 @@
 public synchronized void
 setFile(String file)
 {
-  this.file = file;
+  if (file == "")
+    this.file = null;
+  else
+    this.file = file;
+  
   if (peer != null)
     {
       FileDialogPeer f = (FileDialogPeer) peer;
@@ -366,5 +375,22 @@
 	  ",mode=" + mode + "," + super.paramString());
 }
 
+/**
+ * Generate a unique name for this <code>FileDialog</code>.
+ *
+ * @return A unique name for this <code>FileDialog</code>.
+ */
+String 
+generateName()
+{
+  return "filedlg" + getUniqueLong();
+}
+
+private static synchronized long 
+getUniqueLong()
+{
+  return next_file_dialog_number++;
+}
+
 } // class FileDialog 
 

Reply via email to