]> source.dussan.org Git - tigervnc.git/commitdiff
Moved OS X setDockIconImage call into VncViewer.setLookAndFeel so that the dockImage...
authorBrian Hinz <bphinz@users.sourceforge.net>
Fri, 10 Jan 2014 04:05:32 +0000 (04:05 +0000)
committerBrian Hinz <bphinz@users.sourceforge.net>
Fri, 10 Jan 2014 04:05:32 +0000 (04:05 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5153 3789f03b-4d11-0410-bbf8-ca57d06f2519

java/com/tigervnc/vncviewer/Viewport.java
java/com/tigervnc/vncviewer/VncViewer.java

index e7d76a54d321a0596433168331ec4c36313d108a..8cb87b6f0b181d9430d7f5b51d5c75a2f19f60b6 100644 (file)
@@ -42,23 +42,8 @@ public class Viewport extends JFrame
     setTitle(name+" - TigerVNC");
     setFocusable(false);
     setFocusTraversalKeysEnabled(false);
-    if (VncViewer.os.startsWith("mac os x")) {
-      try {
-        Class appClass = Class.forName("com.apple.eawt.Application");
-        Method getApplication = 
-          appClass.getMethod("getApplication", (Class[])null);
-        Object app = getApplication.invoke(appClass);
-        Class paramTypes[] = new Class[1];
-        paramTypes[0] = Image.class;
-        Method setDockIconImage = 
-          appClass.getMethod("setDockIconImage", paramTypes);
-        setDockIconImage.invoke(app, VncViewer.logoImage);
-      } catch (Exception e) {
-        vlog.debug("Could not set OS X dock icon: " + e.getMessage());
-      }
-    } else {
+    if (!VncViewer.os.startsWith("mac os x"))
       setIconImage(VncViewer.frameIcon);
-    }
     UIManager.getDefaults().put("ScrollPane.ancestorInputMap",
       new UIDefaults.LazyInputMap(new Object[]{}));
     sp = new JScrollPane();
index e63ec3b1862789603f90446ab4477ccd075a3de6..8d9b23a674c1b1e558007565e051ec0ed86b9b09 100644 (file)
@@ -39,6 +39,7 @@ import java.io.InputStream;
 import java.io.IOException;
 import java.io.File;
 import java.lang.Character;
+import java.lang.reflect.*;
 import java.util.jar.Attributes;
 import java.util.jar.Manifest;
 import java.util.*;
@@ -75,6 +76,17 @@ public class VncViewer extends javax.swing.JApplet
 
   public static void setLookAndFeel() {
     try {
+      if (os.startsWith("mac os x")) {
+        Class appClass = Class.forName("com.apple.eawt.Application");
+        Method getApplication = 
+          appClass.getMethod("getApplication", (Class[])null);
+        Object app = getApplication.invoke(appClass);
+        Class paramTypes[] = new Class[1];
+        paramTypes[0] = Image.class;
+        Method setDockIconImage = 
+          appClass.getMethod("setDockIconImage", paramTypes);
+        setDockIconImage.invoke(app, VncViewer.logoImage);
+      }
       // Use Nimbus LookAndFeel if it's available, otherwise fallback
       // to the native laf, or Metal if no native laf is available.
       String laf = System.getProperty("swing.defaultlaf");