diff options
author | Brian Hinz <bphinz@users.sourceforge.net> | 2014-01-10 04:05:32 +0000 |
---|---|---|
committer | Brian Hinz <bphinz@users.sourceforge.net> | 2014-01-10 04:05:32 +0000 |
commit | 77453e6f87758d456d8e304dd927c9cff533af62 (patch) | |
tree | c0738162426bbc3436ed058860dc7585835225a0 /java | |
parent | 1ed4d50a95654df453f6d1adf042786bbcc75591 (diff) | |
download | tigervnc-77453e6f87758d456d8e304dd927c9cff533af62.tar.gz tigervnc-77453e6f87758d456d8e304dd927c9cff533af62.zip |
Moved OS X setDockIconImage call into VncViewer.setLookAndFeel so that the dockImage gets set faster.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5153 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'java')
-rw-r--r-- | java/com/tigervnc/vncviewer/Viewport.java | 17 | ||||
-rw-r--r-- | java/com/tigervnc/vncviewer/VncViewer.java | 12 |
2 files changed, 13 insertions, 16 deletions
diff --git a/java/com/tigervnc/vncviewer/Viewport.java b/java/com/tigervnc/vncviewer/Viewport.java index e7d76a54..8cb87b6f 100644 --- a/java/com/tigervnc/vncviewer/Viewport.java +++ b/java/com/tigervnc/vncviewer/Viewport.java @@ -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(); diff --git a/java/com/tigervnc/vncviewer/VncViewer.java b/java/com/tigervnc/vncviewer/VncViewer.java index e63ec3b1..8d9b23a6 100644 --- a/java/com/tigervnc/vncviewer/VncViewer.java +++ b/java/com/tigervnc/vncviewer/VncViewer.java @@ -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"); |