import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

/*
<APPLET
    CODE = password.class
    WIDTH = 350
    HEIGHT = 280 >
</APPLET>
*/

public class password extends JApplet 
{
    String correctpassword = "open sesame";
    JPasswordField jpasswordfield = new JPasswordField(10);

    public void init() 
    {
        Container contentPane = getContentPane();

        contentPane.setLayout(new FlowLayout());
        contentPane.add(new JLabel("Type your password: "));
        contentPane.add(jpasswordfield);

        jpasswordfield.setEchoChar('*');

        jpasswordfield.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                String input = new String(jpasswordfield.getPassword());

                if(correctpassword.equals(input))
                    showStatus("Correct");
                else
                    showStatus("Incorrect");
            }
        });
    }
}
