[izpack-changes] izpack-src/src/lib/com/izforge/izpack/uninstaller UninstallerFrame.java,1.22.4.2,1.22.4.3 Uninstaller.java,1.18.4.1,1.18.4.2

jponge nobody at sheep.berlios.de
Thu Feb 2 16:56:00 CET 2006


Update of /cvsroot/izpack//izpack-src/src/lib/com/izforge/izpack/uninstaller
In directory sheep:/tmp/cvs-serv22927/src/lib/com/izforge/izpack/uninstaller

Modified Files:
      Tag: branch-3-8
	UninstallerFrame.java Uninstaller.java 
Log Message:
Swing threading fixes. IzPack looks faster like that!

Index: UninstallerFrame.java
===================================================================
RCS file: /cvsroot/izpack//izpack-src/src/lib/com/izforge/izpack/uninstaller/UninstallerFrame.java,v
retrieving revision 1.22.4.2
retrieving revision 1.22.4.3
diff -u -d -r1.22.4.2 -r1.22.4.3
--- UninstallerFrame.java	3 Jan 2006 13:54:04 -0000	1.22.4.2
+++ UninstallerFrame.java	2 Feb 2006 15:55:57 -0000	1.22.4.3
@@ -48,6 +48,7 @@
 import javax.swing.JOptionPane;
 import javax.swing.JPanel;
 import javax.swing.JProgressBar;
+import javax.swing.SwingUtilities;
 import javax.swing.UIManager;
 
 import com.izforge.izpack.LocaleDatabase;
@@ -330,20 +331,30 @@
          * @param name The name of the overall action. Not used here.
          * @param max The maximum value of the progress.
          */
-        public void startAction(String name, int max)
+        public void startAction(final String name, final int max)
         {
-            progressBar.setMinimum(0);
-            progressBar.setMaximum(max);
-            blockGUI();
+            SwingUtilities.invokeLater(new Runnable() {
+                public void run()
+                {
+                    progressBar.setMinimum(0);
+                    progressBar.setMaximum(max);
+                    blockGUI();                    
+                }
+            });
         }
 
         /** The destroyer stops. */
         public void stopAction()
         {
-            progressBar.setString(langpack.getString("InstallPanel.finished"));
-            targetDestroyCheckbox.setEnabled(false);
-            destroyButton.setEnabled(false);
-            releaseGUI();
+            SwingUtilities.invokeLater(new Runnable() {
+                public void run()
+                {
+                    progressBar.setString(langpack.getString("InstallPanel.finished"));
+                    targetDestroyCheckbox.setEnabled(false);
+                    destroyButton.setEnabled(false);
+                    releaseGUI();
+                }
+            });
         }
 
         /**
@@ -352,10 +363,15 @@
          * @param pos The actual position.
          * @param message The message.
          */
-        public void progress(int pos, String message)
+        public void progress(final int pos, final String message)
         {
-            progressBar.setValue(pos);
-            progressBar.setString(message);
+            SwingUtilities.invokeLater(new Runnable() {
+                public void run()
+                {
+                    progressBar.setValue(pos);
+                    progressBar.setString(message);
+                }
+            });
         }
 
         public void nextStep(String step_name, int step_no, int no_of_substeps)

Index: Uninstaller.java
===================================================================
RCS file: /cvsroot/izpack//izpack-src/src/lib/com/izforge/izpack/uninstaller/Uninstaller.java,v
retrieving revision 1.18.4.1
retrieving revision 1.18.4.2
diff -u -d -r1.18.4.1 -r1.18.4.2
--- Uninstaller.java	3 Jan 2006 13:54:05 -0000	1.18.4.1
+++ Uninstaller.java	2 Feb 2006 15:55:57 -0000	1.18.4.2
@@ -21,6 +21,7 @@
 
 import java.lang.reflect.Method;
 
+import javax.swing.SwingUtilities;
 import javax.swing.UIManager;
 
 /**
@@ -56,16 +57,21 @@
 
     public static void uninstall(String[] args)
     {
-        try
-        {
-            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
-            new UninstallerFrame();
-        }
-        catch (Exception err)
-        {
-            System.err.println("- Error -");
-            err.printStackTrace();
-            System.exit(0);
-        }
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run()
+            {
+                try
+                {
+                    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+                    new UninstallerFrame();
+                }
+                catch (Exception err)
+                {
+                    System.err.println("- Error -");
+                    err.printStackTrace();
+                    System.exit(0);
+                }
+            }
+        });
     }
 }




More information about the izpack-changes mailing list