This fixes a problem in JOptionPane. We were trying to be clever in BasicOptionPane's PropertyChangeHandler about changing visual properties. I changed this to cleanly uninstall and reinstall the JOptionPane's components, which fixes the problem and is what the JDK does AFAICS.

2006-07-31  Roman Kennke  <[EMAIL PROTECTED]>

        PR 28562
        * javax/swing/plaf/basic/BasicOptionPaneUI.java
        (PropertyChangeHandler.propertyChange): Uninstall and reinstall
        component when visual properties change.

/Roman
Index: javax/swing/plaf/basic/BasicOptionPaneUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java,v
retrieving revision 1.33
diff -u -1 -2 -r1.33 BasicOptionPaneUI.java
--- javax/swing/plaf/basic/BasicOptionPaneUI.java	26 Jul 2006 13:39:38 -0000	1.33
+++ javax/swing/plaf/basic/BasicOptionPaneUI.java	1 Aug 2006 15:39:45 -0000
@@ -418,35 +418,28 @@
                || e.getPropertyName().equals(JOptionPane.OPTION_TYPE_PROPERTY))
         {
 	  Container newButtons = createButtonArea();
 	  optionPane.remove(buttonContainer);
 	  optionPane.add(newButtons);
 	  buttonContainer = newButtons;
         }
 
       else if (e.getPropertyName().equals(JOptionPane.MESSAGE_PROPERTY)
                || e.getPropertyName().equals(JOptionPane.WANTS_INPUT_PROPERTY)
                || e.getPropertyName().equals(JOptionPane.SELECTION_VALUES_PROPERTY))
         {
-          optionPane.remove(messageAreaContainer);
-          messageAreaContainer = createMessageArea();
-          optionPane.add(messageAreaContainer);
-          Container newButtons = createButtonArea();
-          optionPane.remove(buttonContainer);
-          optionPane.add(newButtons);
-          buttonContainer = newButtons;
-          optionPane.add(buttonContainer);
+          uninstallComponents();
+          installComponents();
+          optionPane.validate();
         }
-      optionPane.invalidate();
-      optionPane.repaint();
     }
   }
 
   /**
    * The minimum width for JOptionPanes.
    */
   public static final int MinimumWidth = 262;
 
   /**
    * The minimum height for JOptionPanes.
    */
   public static final int MinimumHeight = 90;

Reply via email to