I want to suggest you use a JPasswordField rather than a JTextField. Perfect scenario