| 162 | } |
| 163 | |
| 164 | protected static String passwordDialog(Frame owner, String title) { |
| 165 | final Dialog box = new Dialog(owner, title, true); |
| 166 | final TextField textField = new TextField(20); |
| 167 | textField.setEchoChar('*'); |
| 168 | Panel buttonPane = new Panel(new FlowLayout()); |
| 169 | Button cancelButton = new Button("Cancel"); |
| 170 | Button okayButton = new Button("Okay"); |
| 171 | cancelButton.addActionListener(new ActionListener() { |
| 172 | public void actionPerformed(ActionEvent event) { |
| 173 | textField.setText(""); |
| 174 | box.setVisible(false); |
| 175 | } |
| 176 | }); |
| 177 | okayButton.addActionListener(new ActionListener() { |
| 178 | public void actionPerformed(ActionEvent event) { |
| 179 | box.setVisible(false); |
| 180 | } |
| 181 | }); |
| 182 | box.add(new Label("Password:"), BorderLayout.NORTH); |
| 183 | box.add(textField, BorderLayout.CENTER); |
| 184 | buttonPane.add(cancelButton); |
| 185 | buttonPane.add(okayButton); |
| 186 | box.add(buttonPane, BorderLayout.SOUTH); |
| 187 | box.pack(); |
| 188 | box.setVisible(true); |
| 189 | box.dispose(); |
| 190 | String pwd = textField.getText(); |
| 191 | if (pwd.length() == 0) |
| 192 | return null; |
| 193 | return pwd; |
| 194 | } |
| 195 | |
| 196 | public class LogDialog extends Dialog implements ActionListener, KeyListener{ |
| 197 | TextArea info = new TextArea(""); |