Search code examples
javajpasswordfield

java password field: which unicode represents the dot


Is there a code for the basic dot in password fields ? This one : dot

I have a button that shows the password (with setEchoChar()), but it's ugly if I put stars (*) when the user hide again the password.

Thanks.
(and btw first post, so if there is something I should change don't hesitate to say it)

Here is the most important part of the code :

  if (getjCheckBox().isSelected()){
    getjPasswordField().setEchoChar((char)0);
  } else {
    getjPasswordField().setEchoChar('*');
  }

Solution

  • You can't look for an ASCII character because it's not an ASCII character but an unicode one. The one you are looking for should be this one.

    Which can be set through field.setEchoChar('\u2022');

    But the more reasonable choice would be to override the default one used by the current look and feel.