import java.awt.*; import java.awt.event.*; class LoginDialog extends Dialog implements ActionListener { TextField username, password; String result; LoginDialog() { super(new Frame(), "Login", true); setLayout(new GridLayout(3,1)); add(username = new TextField(8)); add(password = new TextField(8)); username.setBackground(Color.white); password.setBackground(Color.white); password.setEchoChar('*'); Panel p = new Panel(); Button b = new Button("OK"); b.addActionListener(this); p.add(b); b = new Button("Create"); b.addActionListener(this); p.add(b); b = new Button("Cancel"); b.addActionListener(this); p.add(b); add(p); pack(); } public void actionPerformed(ActionEvent e) { result = e.getActionCommand(); dispose(); } }