Revision: 4192
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4192&view=rev
Author:   atkac
Date:     2010-11-11 13:25:14 +0000 (Thu, 11 Nov 2010)

Log Message:
-----------
[Development] java: Support asking for a user name. (Martin Koegler)

Modified Paths:
--------------
    trunk/java/src/com/tigervnc/vncviewer/AuthPanel.java
    trunk/java/src/com/tigervnc/vncviewer/VncViewer.java

Modified: trunk/java/src/com/tigervnc/vncviewer/AuthPanel.java
===================================================================
--- trunk/java/src/com/tigervnc/vncviewer/AuthPanel.java        2010-11-11 
13:21:55 UTC (rev 4191)
+++ trunk/java/src/com/tigervnc/vncviewer/AuthPanel.java        2010-11-11 
13:25:14 UTC (rev 4192)
@@ -31,22 +31,29 @@
 
   TextField passwordField;
   Button okButton;
+  boolean AskPassword;
 
   //
   // Constructor.
   //
 
-  public AuthPanel(VncViewer viewer)
+  public AuthPanel(VncViewer viewer, boolean askpassword)
   {
+    AskPassword = askpassword;
     Label titleLabel = new Label("VNC Authentication", Label.CENTER);
     titleLabel.setFont(new Font("Helvetica", Font.BOLD, 18));
 
-    Label promptLabel = new Label("Password:", Label.CENTER);
+    Label promptLabel;
+    if (AskPassword)
+      promptLabel = new Label("Password:", Label.CENTER);
+    else
+      promptLabel = new Label("User:", Label.CENTER);
 
     passwordField = new TextField(10);
     passwordField.setForeground(Color.black);
     passwordField.setBackground(Color.white);
-    passwordField.setEchoChar('*');
+    if (AskPassword)
+      passwordField.setEchoChar('*');
 
     okButton = new Button("OK");
 

Modified: trunk/java/src/com/tigervnc/vncviewer/VncViewer.java
===================================================================
--- trunk/java/src/com/tigervnc/vncviewer/VncViewer.java        2010-11-11 
13:21:55 UTC (rev 4191)
+++ trunk/java/src/com/tigervnc/vncviewer/VncViewer.java        2010-11-11 
13:25:14 UTC (rev 4192)
@@ -437,11 +437,40 @@
   // Show an authentication panel.
   //
 
+  String askUser() throws Exception
+  {
+    showConnectionStatus(null);
+
+    AuthPanel authPanel = new AuthPanel(this, false);
+
+    GridBagConstraints gbc = new GridBagConstraints();
+    gbc.gridwidth = GridBagConstraints.REMAINDER;
+    gbc.anchor = GridBagConstraints.NORTHWEST;
+    gbc.weightx = 1.0;
+    gbc.weighty = 1.0;
+    gbc.ipadx = 100;
+    gbc.ipady = 50;
+    gridbag.setConstraints(authPanel, gbc);
+    vncContainer.add(authPanel);
+
+    if (inSeparateFrame) {
+      vncFrame.pack();
+    } else {
+      validate();
+    }
+
+    authPanel.moveFocusToDefaultField();
+    String pw = authPanel.getPassword();
+    vncContainer.remove(authPanel);
+
+    return pw;
+  }
+
   String askPassword() throws Exception
   {
     showConnectionStatus(null);
 
-    AuthPanel authPanel = new AuthPanel(this);
+    AuthPanel authPanel = new AuthPanel(this, true);
 
     GridBagConstraints gbc = new GridBagConstraints();
     gbc.gridwidth = GridBagConstraints.REMAINDER;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Tigervnc-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tigervnc-commits

Reply via email to