Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JPasswordField setEchoChar not working....why???

843785Aug 26 2008 — edited Aug 27 2008
JPasswordField password = new JPasswordField(15);
password.setEchoChar("#");

when put as a class variable,
doesn't compile, giving errors "identifier expected" and "illegal start of type".

if i put it in the constructor, it says
setEchoChar(char) in javax.swing.JPasswordField cannot be applied to (java.lang.String)

if i put it in the main, it says
non-static variable password cannot be referenced from a static context.

why and what to do????
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 24 2008
Added on Aug 26 2008
17 comments
1,564 views