jPasswordField in Java
jPasswordField in java is part of the javax.swing package. jPasswordField is a component that allows the user to input a password that does not show the actual letter or character inputted in the password field.
Java jPasswordField Show or Hide Password
Well, to show the actual characters inputted in the password field in Java. You will need the setEchoChar() method to actually see it.
-
getEchoChar() – Returns the character to be used for echoing.
-
setEchoChar() – Sets the echo character for this JPasswordField.
Example
password.setEchoChar('*'); password.getEchoChar();
The output here will be * asterisk because we have set the EchoChar to *. So, showing the actual characters will be this. See the example code below.
Another Example
if(jToggleButton1.isSelected()){ pass.setEchoChar((char)0); //By this line of code. We will actually see the actual characters jToggleButton1.setText("Hide"); }else{ pass.setEchoChar('u25cf'); jToggleButton1.setText("Show"); }
When the JToggleButton is selected, the actual characters will show. If you hide the characters, the setEchoChar(‘u25cf’); is going to handle it. the output of the u25cf will be the black circle dot.
Output
Scheiß werbeverseuchte Plattform. Erstmal javascript abschalten😁😁😁😁