From 46395b7ff2f6ea7bf20da6d7199a6502b74546b3 Mon Sep 17 00:00:00 2001 From: Brian Hinz Date: Wed, 6 Mar 2013 14:52:10 +0000 Subject: [PATCH] Use JDialog for connection info dialog so that frame icon is set correctly. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5057 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- java/com/tigervnc/vncviewer/CConn.java | 41 +++++++++++++++++--------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/java/com/tigervnc/vncviewer/CConn.java b/java/com/tigervnc/vncviewer/CConn.java index 0a7526ee..b8cbbfef 100644 --- a/java/com/tigervnc/vncviewer/CConn.java +++ b/java/com/tigervnc/vncviewer/CConn.java @@ -735,20 +735,33 @@ public class CConn extends CConnection Window fullScreenWindow = Viewport.getFullScreenWindow(); if (fullScreenWindow != null) Viewport.setFullScreenWindow(null); - JOptionPane.showMessageDialog(viewport, - "Desktop name: "+cp.name()+"\n" - +"Host: "+sock.getPeerName()+":"+sock.getPeerPort()+"\n" - +"Size: "+cp.width+"x"+cp.height+"\n" - +"Pixel format: "+desktop.getPF().print()+"\n" - +"(server default "+serverPF.print()+")\n" - +"Requested encoding: "+Encodings.encodingName(currentEncoding)+"\n" - +"Last used encoding: "+Encodings.encodingName(lastServerEncoding)+"\n" - +"Line speed estimate: "+sock.inStream().kbitsPerSecond()+" kbit/s"+"\n" - +"Protocol version: "+cp.majorVersion+"."+cp.minorVersion+"\n" - +"Security method: "+Security.secTypeName(csecurity.getType()) - +" ["+csecurity.description()+"]", - "VNC connection info", - JOptionPane.PLAIN_MESSAGE); + String info = new String("Desktop name: %s%n"+ + "Host: %s:%d%n"+ + "Size: %dx%d%n"+ + "Pixel format: %s%n"+ + " (server default: %s)%n"+ + "Requested encoding: %s%n"+ + "Last used encoding: %s%n"+ + "Line speed estimate: %d kbit/s%n"+ + "Protocol version: %d.%d%n"+ + "Security method: %s [%s]%n"); + String msg = + String.format(info, cp.name(), + sock.getPeerName(), sock.getPeerPort(), + cp.width, cp.height, + desktop.getPF().print(), + serverPF.print(), + Encodings.encodingName(currentEncoding), + Encodings.encodingName(lastServerEncoding), + sock.inStream().kbitsPerSecond(), + cp.majorVersion, cp.minorVersion, + Security.secTypeName(csecurity.getType()), + csecurity.description()); + JOptionPane op = new JOptionPane(msg, JOptionPane.PLAIN_MESSAGE, + JOptionPane.DEFAULT_OPTION); + JDialog dlg = op.createDialog("VNC connection info"); + dlg.setIconImage(VncViewer.frameIcon); + dlg.setVisible(true); if (fullScreenWindow != null) Viewport.setFullScreenWindow(fullScreenWindow); } -- 2.39.5