I would like to capture the input after the <enter> key is hit rather than using a JButton. Anyone have ideas on how I could do this? Thanks for your help!
Below is the code I am using. I have a local web site setup and and trying to password protect it. This brings up the applet but even if I write in the correct value(Test) for field myTextField, I always get dropped to the else statement. Thanks.....
public class JPasswordA extends JApplet implements ActionListener
{//1
JLabel myPassword = new JLabel("Enter A Password"
JTextField myTextField = new JTextField("", 15);
Font myFont = new Font("Arial", Font.BOLD + Font.ITALIC, 18);
Container con = getContentPane();
FlowLayout flow = new FlowLayout();
JLabel status = new JLabel(""
public void init()
{
con.setLayout(flow);
con.add(myPassword);
con.add(myTextField);
con.add(status);
myTextField.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.