/* */ package NET.worlds.console; /* */ /* */ import java.awt.Button; /* */ import java.awt.Event; /* */ import java.awt.Font; /* */ import java.awt.GridBagConstraints; /* */ import java.awt.GridBagLayout; /* */ import java.awt.Label; /* */ import java.awt.Panel; /* */ import java.awt.TextField; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ class AddNameDialog /* */ extends PolledDialog /* */ { /* */ private static final long serialVersionUID = -6679739808485406091L; /* */ private TextField nameField; /* 216 */ private Button okButton = new Button(Console.message("OK")); /* 217 */ private Button cancelButton = new Button(Console.message("Cancel")); /* */ private String newName; /* 219 */ private static Font font = new Font(Console.message("ButtonFont"), /* 220 */ 0, 12); /* */ /* */ AddNameDialog(EditNamesDialog parent, String title) /* */ { /* 224 */ super(parent, parent, title, true); /* 225 */ ready(); /* */ } /* */ /* */ /* */ protected void build() /* */ { /* 231 */ this.nameField = new TextField("", 40); /* 232 */ this.nameField.setFont(font); /* 233 */ GridBagLayout gbag = new GridBagLayout(); /* 234 */ setLayout(gbag); /* 235 */ GridBagConstraints c = new GridBagConstraints(); /* 236 */ c.fill = 0; /* 237 */ c.weightx = 1.0D; /* 238 */ c.weighty = 1.0D; /* 239 */ c.gridwidth = 2; /* 240 */ c.gridheight = 1; /* 241 */ add(gbag, new Label(Console.message("Name")), c); /* 242 */ c.gridwidth = 0; /* 243 */ c.fill = 2; /* 244 */ add(gbag, this.nameField, c); /* 245 */ Panel buttons = new Panel(); /* 246 */ this.okButton.setFont(font); /* 247 */ this.cancelButton.setFont(font); /* 248 */ buttons.add(this.okButton); /* 249 */ buttons.add(this.cancelButton); /* 250 */ c.gridwidth = 0; /* 251 */ c.fill = 0; /* 252 */ add(gbag, buttons, c); /* */ } /* */ /* */ /* */ @Deprecated /* */ public boolean action(Event event, Object what) /* */ { /* 259 */ Object target = event.target; /* 260 */ if ((target == this.okButton) && (mayConfirm())) /* 261 */ return done(true); /* 262 */ if (target == this.cancelButton) /* 263 */ return done(false); /* 264 */ return false; /* */ } /* */ /* */ /* */ public String getName() /* */ { /* 270 */ return this.newName; /* */ } /* */ /* */ /* */ /* */ /* */ private boolean mayConfirm() /* */ { /* 278 */ return FriendsListPart.isValidUserName(this.newName = this.nameField.getText() /* 279 */ .trim()); /* */ } /* */ /* */ /* */ @Deprecated /* */ public boolean keyDown(Event event, int key) /* */ { /* 286 */ if (key == 27) /* 287 */ return done(false); /* 288 */ if ((key == 10) && /* 289 */ (mayConfirm())) { /* 290 */ return done(true); /* */ } /* 292 */ return super.keyDown(event, key); /* */ } /* */ /* */ /* */ /* */ /* */ public void setVisible(boolean visible) /* */ { /* 300 */ super.setVisible(visible); /* 301 */ if (visible) { /* 302 */ this.nameField.requestFocus(); /* 303 */ this.nameField.selectAll(); /* */ } /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\AddNameDialog.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */