Signed-off-by: Martin Koegler <mkoeg...@auto.tuwien.ac.at>
---
 java/src/com/tigervnc/vncviewer/AuthPanel.java |   13 +++++++--
 java/src/com/tigervnc/vncviewer/VncViewer.java |   31 +++++++++++++++++++++++-
 2 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/java/src/com/tigervnc/vncviewer/AuthPanel.java 
b/java/src/com/tigervnc/vncviewer/AuthPanel.java
index 04d3bde..a23758e 100644
--- a/java/src/com/tigervnc/vncviewer/AuthPanel.java
+++ b/java/src/com/tigervnc/vncviewer/AuthPanel.java
@@ -31,22 +31,29 @@ class AuthPanel extends Panel implements ActionListener {
 
   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");
 
diff --git a/java/src/com/tigervnc/vncviewer/VncViewer.java 
b/java/src/com/tigervnc/vncviewer/VncViewer.java
index 711b1c9..19541af 100644
--- a/java/src/com/tigervnc/vncviewer/VncViewer.java
+++ b/java/src/com/tigervnc/vncviewer/VncViewer.java
@@ -437,11 +437,40 @@ public class VncViewer extends java.applet.Applet
   // 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;
-- 
1.5.6.5


------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel

Reply via email to