]> source.dussan.org Git - tigervnc.git/commitdiff
[java] don't show password field for secTypes that don't use it
authorBrian P. Hinz <bphinz@users.sf.net>
Fri, 4 Sep 2020 23:09:48 +0000 (19:09 -0400)
committerBrian P. Hinz <bphinz@users.sf.net>
Fri, 4 Sep 2020 23:14:34 +0000 (19:14 -0400)
java/com/tigervnc/vncviewer/UserDialog.java

index 9804aafa2d7f443546f6abfd338640b13e5ddcf7..d35be48d3c2f7fac7cd3d5b04cb71d286b9bbf4c 100644 (file)
@@ -129,14 +129,16 @@ public class UserDialog implements UserPasswdGetter, UserMsgBox
       y += 25 + 5;
     }
 
-    JLabel passwdLabel = new JLabel("Password:");
-    passwdLabel.setBounds(70, y, msg.getSize().width-70-10, 20);
-    msg.add(passwdLabel);
-    y += 20 + 5;
     final JPasswordField passwd = new JPasswordField(30);
-    passwd.setBounds(70, y, msg.getSize().width-70-10, 25);
-    msg.add(passwd);
-    y += 25 + 5;
+    if (password != null) {
+      JLabel passwdLabel = new JLabel("Password:");
+      passwdLabel.setBounds(70, y, msg.getSize().width-70-10, 20);
+      msg.add(passwdLabel);
+      y += 20 + 5;
+      passwd.setBounds(70, y, msg.getSize().width-70-10, 25);
+      msg.add(passwd);
+      y += 25 + 5;
+    }
 
     msg.setPreferredSize(new Dimension(410, y));
 
@@ -149,7 +151,8 @@ public class UserDialog implements UserPasswdGetter, UserMsgBox
                                       options[0]){//default button title
       @Override
       public void selectInitialValue() {
-        passwd.requestFocusInWindow();
+        if (password != null)
+          passwd.requestFocusInWindow();
       }
     };
     pane.setBorder(new EmptyBorder(0,0,0,0));