How to check if JPassword field is null
问题 I want to check the username and password in Swing. The check works for username, but it doesn't work for JPaswordfield. I am posting the related code: //Here I get the password Char[] pwd = jt1.getPassword(); String s = new String(pwd); //converting char to string String p = s; //In the JButton checking username and password(Username check works fine but not passwordfield) jb.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if ((jt.getText().length()) ==