/hg/icedtea-web: PR857: Don't set look and feel multiple times

omajid at icedtea.classpath.org omajid at icedtea.classpath.org
Tue Mar 4 07:35:45 PST 2014


changeset 07d7757eda0c in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=07d7757eda0c
author: Omair Majid <omajid at redhat.com>
date: Tue Mar 04 10:35:17 2014 -0500

	PR857: Don't set look and feel multiple times

	2014-03-03  Omair Majid  <omajid at redhat.com>

	    PR857
	    * netx/net/sourceforge/jnlp/about/AboutDialog.java
	    (run): Do not set look and feel.
	    * netx/net/sourceforge/jnlp/runtime/Boot.java
	    (main) <about>: Set look and feel before displaying dialog.
	    * netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
	    (initialize): Set look and feel before any UI is created.
	    * netx/net/sourceforge/jnlp/security/SecurityDialog.java
	    (init): Do not set look and feel.
	    (setSystemLookAndFeel): Removed.
	    * netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java
	    (createInstance): Do not set look and feel.
	    * netx/net/sourceforge/jnlp/security/viewer/CertificateViewer.java
	    (showCertificateViewer): Do not set look and feel.
	    (setSystemLookAndFeel): Removed.


diffstat:

 ChangeLog                                                         |  18 ++++++++++
 netx/net/sourceforge/jnlp/about/AboutDialog.java                  |   5 --
 netx/net/sourceforge/jnlp/runtime/Boot.java                       |   7 +++
 netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java                |  12 +++---
 netx/net/sourceforge/jnlp/security/SecurityDialog.java            |  13 -------
 netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java |   5 --
 netx/net/sourceforge/jnlp/security/viewer/CertificateViewer.java  |   9 -----
 7 files changed, 31 insertions(+), 38 deletions(-)

diffs (164 lines):

diff -r 3381129e3ae2 -r 07d7757eda0c ChangeLog
--- a/ChangeLog	Mon Mar 03 12:21:19 2014 -0500
+++ b/ChangeLog	Tue Mar 04 10:35:17 2014 -0500
@@ -1,3 +1,21 @@
+2014-03-03  Omair Majid  <omajid at redhat.com>
+
+	PR857
+	* netx/net/sourceforge/jnlp/about/AboutDialog.java
+	(run): Do not set look and feel.
+	* netx/net/sourceforge/jnlp/runtime/Boot.java
+	(main) <about>: Set look and feel before displaying dialog.
+	* netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
+	(initialize): Set look and feel before any UI is created.
+	* netx/net/sourceforge/jnlp/security/SecurityDialog.java
+	(init): Do not set look and feel.
+	(setSystemLookAndFeel): Removed.
+	* netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java
+	(createInstance): Do not set look and feel.
+	* netx/net/sourceforge/jnlp/security/viewer/CertificateViewer.java
+	(showCertificateViewer): Do not set look and feel.
+	(setSystemLookAndFeel): Removed.
+
 2014-03-03  Omair Majid  <omajid at redhat.com>
 
 	PR1676
diff -r 3381129e3ae2 -r 07d7757eda0c netx/net/sourceforge/jnlp/about/AboutDialog.java
--- a/netx/net/sourceforge/jnlp/about/AboutDialog.java	Mon Mar 03 12:21:19 2014 -0500
+++ b/netx/net/sourceforge/jnlp/about/AboutDialog.java	Tue Mar 04 10:35:17 2014 -0500
@@ -175,11 +175,6 @@
 
     @Override
     public void run() {
-        try {
-            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
-        } catch (Exception e) {
-        }
-
         layoutWindow();
         ScreenFinder.centerWindowsToCurrentScreen(frame);
         frame.setVisible(true);
diff -r 3381129e3ae2 -r 07d7757eda0c netx/net/sourceforge/jnlp/runtime/Boot.java
--- a/netx/net/sourceforge/jnlp/runtime/Boot.java	Mon Mar 03 12:21:19 2014 -0500
+++ b/netx/net/sourceforge/jnlp/runtime/Boot.java	Tue Mar 04 10:35:17 2014 -0500
@@ -28,6 +28,8 @@
 import java.util.List;
 import java.util.Map;
 
+import javax.swing.UIManager;
+
 import net.sourceforge.jnlp.LaunchException;
 import net.sourceforge.jnlp.Launcher;
 import net.sourceforge.jnlp.ParserSettings;
@@ -161,6 +163,11 @@
             if (null != getOption("-headless")) {
                 JNLPRuntime.exit(0);
             } else {
+                try {
+                    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+                } catch (Exception e) {
+                    OutputController.getLogger().log("Unable to set system look and feel");
+                }
                 OutputController.getLogger().printOutLn(R("BLaunchAbout"));
                 AboutDialog.display();
                 return;
diff -r 3381129e3ae2 -r 07d7757eda0c netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java
--- a/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java	Mon Mar 03 12:21:19 2014 -0500
+++ b/netx/net/sourceforge/jnlp/runtime/JNLPRuntime.java	Tue Mar 04 10:35:17 2014 -0500
@@ -195,6 +195,12 @@
     public static void initialize(boolean isApplication) throws IllegalStateException {
         checkInitialized();
 
+        try {
+            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+        } catch (Exception e) {
+            OutputController.getLogger().log("Unable to set system look and feel");
+        }
+
         if (JavaConsole.canShowOnStartup(isApplication)) {
             JavaConsole.getConsole().showConsoleLater();
         }
@@ -236,12 +242,6 @@
         policy = new JNLPPolicy();
         security = new JNLPSecurityManager(); // side effect: create JWindow
 
-        try {
-            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
-        } catch (Exception e) {
-            OutputController.getLogger().log(OutputController.Level.ERROR_ALL, e);
-        }
-
         doMainAppContextHacks();
 
         if (securityEnabled) {
diff -r 3381129e3ae2 -r 07d7757eda0c netx/net/sourceforge/jnlp/security/SecurityDialog.java
--- a/netx/net/sourceforge/jnlp/security/SecurityDialog.java	Mon Mar 03 12:21:19 2014 -0500
+++ b/netx/net/sourceforge/jnlp/security/SecurityDialog.java	Tue Mar 04 10:35:17 2014 -0500
@@ -216,8 +216,6 @@
     }
 
     private void initDialog() {
-        setSystemLookAndFeel();
-
         String dialogTitle = "";
         if (dialogType == DialogType.CERT_WARNING) {
             if (accessType == AccessType.VERIFIED)
@@ -346,17 +344,6 @@
         super.dispose();
     }
 
-    /**
-     * Updates the look and feel of the window to be the system look and feel
-     */
-    protected void setSystemLookAndFeel() {
-        try {
-            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
-        } catch (Exception e) {
-            //don't worry if we can't.
-        }
-    }
-
     private final List<ActionListener> listeners = new CopyOnWriteArrayList<ActionListener>();
 
     /**
diff -r 3381129e3ae2 -r 07d7757eda0c netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java
--- a/netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java	Mon Mar 03 12:21:19 2014 -0500
+++ b/netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java	Tue Mar 04 10:35:17 2014 -0500
@@ -917,11 +917,6 @@
     }
 
     public static PolicyEditor createInstance(final String filepath) {
-        try {
-            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
-        } catch (final Exception e) {
-            // not really important, so just ignore
-        }
         return new PolicyEditor(filepath);
     }
 
diff -r 3381129e3ae2 -r 07d7757eda0c netx/net/sourceforge/jnlp/security/viewer/CertificateViewer.java
--- a/netx/net/sourceforge/jnlp/security/viewer/CertificateViewer.java	Mon Mar 03 12:21:19 2014 -0500
+++ b/netx/net/sourceforge/jnlp/security/viewer/CertificateViewer.java	Tue Mar 04 10:35:17 2014 -0500
@@ -100,7 +100,6 @@
 
     public static void showCertificateViewer() throws Exception {
         JNLPRuntime.initialize(true);
-        setSystemLookAndFeel();
 
         CertificateViewer cv = new CertificateViewer();
         cv.setResizable(true);
@@ -109,14 +108,6 @@
         cv.dispose();
     }
 
-    private static void setSystemLookAndFeel() {
-        try {
-            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
-        } catch (Exception e) {
-            // don't worry if we can't.
-        }
-    }
-
     public static void main(String[] args) throws Exception {
         CertificateViewer.showCertificateViewer();
     }


More information about the distro-pkg-dev mailing list