The static JColorChooser.showDialog() method was not working properly, because it used an inner class ModalDialog that obviously didn't get the modal event queue stuff right. The solution is of course to use a plain JDialog that's made modal by calling setModal(true).
2006-03-19 Roman Kennke <[EMAIL PROTECTED]>
* javax/swing/JColorChooser.java
(createDialog): Create JDialog instead of ModalDialog. Make this
dialog modal by calling setModal(true).
(ModalDialog): Removed unnecessary inner class.
/Roman
--
“Improvement makes straight roads, but the crooked roads, without
Improvement, are roads of Genius.” - William Blake
Index: javax/swing/JColorChooser.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JColorChooser.java,v
retrieving revision 1.11
diff -u -r1.11 JColorChooser.java
--- javax/swing/JColorChooser.java 13 Mar 2006 21:33:37 -0000 1.11
+++ javax/swing/JColorChooser.java 19 Mar 2006 19:53:38 -0000
@@ -301,10 +301,9 @@
throw new AWTError("No suitable parent found for Component.");
JDialog dialog;
if (parent instanceof Frame)
- dialog = new ModalDialog((Frame) parent, title);
+ dialog = new JDialog((Frame) parent, title, true);
else
- dialog = new ModalDialog((Dialog) parent, title);
- dialog.setModal(modal);
+ dialog = new JDialog((Dialog) parent, title, true);
dialog.getContentPane().setLayout(new BorderLayout());
@@ -642,64 +641,4 @@
}
}
- /**
- * This is a custom JDialog that will notify when it is hidden and the modal
- * property is set.
- */
- static class ModalDialog extends JDialog
- {
- /** The modal property. */
- private boolean modal;
-
- /**
- * Creates a new ModalDialog object with the given parent and title.
- *
- * @param parent The parent of the JDialog.
- * @param title The title of the JDialog.
- */
- public ModalDialog(Frame parent, String title)
- {
- super(parent, title);
- }
-
- /**
- * Creates a new ModalDialog object with the given parent and title.
- *
- * @param parent The parent of the JDialog.
- * @param title The title of the JDialog.
- */
- public ModalDialog(Dialog parent, String title)
- {
- super(parent, title);
- }
-
- /**
- * This method sets the modal property.
- *
- * @param modal The modal property.
- */
- public void setModal(boolean modal)
- {
- this.modal = modal;
- }
-
- /**
- * This method shows the ModalDialog.
- */
- public void show()
- {
- super.show();
- if (modal)
- makeModal(this);
- }
-
- /**
- * This method hides the ModalDialog.
- */
- public synchronized void hide()
- {
- super.hide();
- notifyAll();
- }
- }
}
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
