classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: fixed setDefaultCloseOperation in JDialog


From: Roman Kennke
Subject: [cp-patches] FYI: fixed setDefaultCloseOperation in JDialog
Date: Fri, 13 May 2005 16:08:09 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204

the method setDefaultCloseOperation has thrown an IllegalArgumentException when it was feeded with illegal arguments, which is nice but not what the reference implementation does. The right behaviour is to accept illegal arguments as DO_NOTHING_ON_CLOSE.

I fixed this.

2005-05-13  Roman Kennke  <address@hidden>

       * javax/swing/JDialog.java
       (setDefaultCloseOperation): Don't throw an IllegalArgumentException
       but instead accept illegal values as DO_NOTHING_ON_CLOSE.

/Roman

Index: javax/swing/JDialog.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JDialog.java,v
retrieving revision 1.11
diff -u -r1.11 JDialog.java
--- javax/swing/JDialog.java    22 Oct 2004 12:43:59 -0000      1.11
+++ javax/swing/JDialog.java    13 May 2005 14:04:34 -0000
@@ -525,7 +525,9 @@
        operation == DISPOSE_ON_CLOSE)
       close_action = operation;
     else
-      throw new IllegalArgumentException("Default close operation must be one 
of DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE, or DISPOSE_ON_CLOSE");
+      // accept illegal value and set the property to the default value,
+      // that's what the reference implementation does
+      close_action = DO_NOTHING_ON_CLOSE;
   }
 
   /**

reply via email to

[Prev in Thread] Current Thread [Next in Thread]