How can I make the password saved from a txt file not in a console
Here is my code: import javax.swing.*; import java.awt.event.*; import java.awt.*; public class password{ private static String password = "pass" //Thanks! public static void main(String [] args){ JFrame a = new JFrame("Password"); a.setSize(400,100); a.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); a.setVisible(true); JLabel label = new JLabel("Enter password"); JPanel panel = new JPanel(); a.add(panel); JPasswordField pass = new JPasswordField(10); pass.setEchoChar('*'); pass.addActionListener(new Action()); panel.add(label, BorderLayout.WEST); panel.add(pass, BorderLayout.EAST); } static class Action implements ActionListener{ public void actionPerformed(ActionEvent e){ JPasswordField input = (JPasswordField) e.getSource(); char[]passy = input.getPassword(); String p = new String (passy); if(p.equals(password)){ JOptionPane.showMessageDialog(null,"Correct"); }else{ JOptionPane.showMessageDialog(null,"Incorrect"); } } } }