문제

I designed a JApplet which had an JTextField getting a password from user. So how can I make applet to display the password in **** form rather than 1234?

도움이 되었습니까?

해결책

Don't use a JTextField. Instead use a JPasswordField which is built just for this use. Note that you handle the data from a JPasswordField a little differently. Since Java String's are interned into the String pool, and thus making them easily discoverable by others, it is dangerous to handle passwords as Strings. Instead use the char array that is returned by calling getPassword() on your JPasswordField object.

For more on this, please check out the JPasswordField Tutorial.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top