Well u can have a look at this.
How to Use Password Fields (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)

The JPasswordField has a method which is setEchoChar()....