public void init() { ok = false; user.requestFocus(); }
protected void focusPassword() { txtPassword.requestFocus(); }
private synchronized void action(Object widget) { if (widget == cancel) { cancel(widget); } else if (widget == login || widget == password) { logIn = true; notify(); } else if (widget == user) { password.requestFocus(); } }
private synchronized void action(final Object widget) { if (widget == cancel) { cancel(widget); } else if (widget == login || widget == password) { logIn = true; notify(); } else if (widget == user) { password.requestFocus(); } }
public void actionPerformed(ActionEvent ae) { if( ae.getActionCommand().equals("Ok") || ae.getSource().equals(passwd)) { if(!user.getText().equals("")) { done(false); } else { // popup an Error? FIXME user.requestFocus(); } } else if ( ae.getActionCommand().equals("Cancel")) { done(true); } else if(ae.getSource().equals(user)) { passwd.requestFocus(); } }
void requestFocusOnNextField(TextField target) { if (target == comp.fields[0]) comp.fields[1].requestFocus(); else if (target == comp.fields[1]) comp.fields[2].requestFocus(); else if (target == comp.fields[2]) comp.fields[3].requestFocus(); else if (target == comp.fields[3]) { comp.fireActionEvent(); comp.fields[0].requestFocus(); comp.fields[0].setText(""); comp.fields[1].setText(""); comp.fields[2].setText(""); comp.fields[3].setText(""); } }
public void actionPerformed(ActionEvent ae) { if( ae.getActionCommand().equals("Ok") || ae.getSource().equals(verify)) { if(passwd.getText().equals(verify.getText()) && !passwd.getText().equals("")) { pae.setValue(passwd.getText()); pae.dispose(); } else { // popup an Error? FIXME passwd.requestFocus(); } } else if ( ae.getActionCommand().equals("Cancel")) { pae.dispose(); } else if(ae.getSource().equals(passwd)) { verify.requestFocus(); } }
public void textValueChanged(TextEvent e) { // I'm sure of that TextField target = (TextField)e.getSource(); String IP = target.getText(); if (IP.length() < 3) return ; if (IP.length() == 4) { target.setText(IP.substring(3)); return; } try { short ip = Short.parseShort(IP); if (ip > 255) { target.setText(""); return ; } } catch (NumberFormatException ex) { target.setText(""); return ; } if (target == comp.fields[0]) comp.fields[1].requestFocus(); else if (target == comp.fields[1]) comp.fields[2].requestFocus(); else if (target == comp.fields[2]) comp.fields[3].requestFocus(); }
public void actionPerformed(ActionEvent e) { login(); loginButton.setEnabled(false); logoutButton.setEnabled(true); tf.requestFocus(); // set keyboard focus in right place! } });
/** * Validates the input fields. * * @return <code>true</code> if all input fields contain valid values, otherwise <code>false</code>. */ protected boolean isInputValid() { String precisionString = this.precisionField.getText(); try { long precision = Long.parseLong(precisionString); if (precision <= 0) { throw new NumberFormatException(); } showStatus(null); return true; } catch (NumberFormatException nfe) { showStatus("Invalid precision: " + precisionString); this.precisionField.requestFocus(); return false; } }
public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { Integer idx = (Integer)e.getItem(); String key = keys.getItem(idx.intValue()); if (key != null) { String value = (String)table.get(key); tkey.setText(key); selectedKey = key; tvalue.setText(value); tkey.requestFocus(); } } }
public void actionPerformed(ActionEvent ae) { if( ae.getActionCommand().equals("Ok") || ae.getSource().equals(passwd)) { if(!user.getText().equals("")) { HttpCredential credential; credential = HttpFactory.makeCredential("Basic"); Base64Encoder encoder = new Base64Encoder(user.getText() +":" +passwd.getText()); credential.setAuthParameter("cookie", encoder.processString()); sb.admin.setCredential(credential); sb.dispose(true); done(); } else { // popup an Error? FIXME user.requestFocus(); } } else if ( ae.getActionCommand().equals("Cancel")) { sb.dispose(false); } else if(ae.getSource().equals(user)) { passwd.requestFocus(); } }
protected void popupDialog() { if(popup == null) { PasswordEditor pe = new PasswordEditor(this, name); popup = new Frame("Jigsaw Password Editor"); popup.setBackground(Color.lightGray); popup.setSize(new Dimension(300, 200)); popup.setLayout(new BorderLayout()); popup.add("Center", pe); popup.show(); pe.passwd.requestFocus(); } }
@Override protected boolean isInputValid() { if (!super.isInputValid()) { return false; } else { String threadsString = this.threadsField.getText(); try { int threads = Integer.parseInt(threadsString); if (threads <= 0) { throw new NumberFormatException(); } showStatus(null); return true; } catch (NumberFormatException nfe) { showStatus("Invalid number of threads: " + threadsString); this.threadsField.requestFocus(); return false; } } }
public void popupDialog(String name) { if(popup == null) { AuthPopup ap = new AuthPopup(this, name); popup = new Frame("Authorization for jigadm"); popup.setBackground(Color.lightGray); popup.setSize(new Dimension(300, 200)); popup.setLayout(new BorderLayout()); popup.add("Center", ap); popup.show(); ap.user.requestFocus(); while(!ap.waitForCompletion()); } }
private void showFindField() { findPanel.setVisible(true); findField.requestFocus(); findField.selectAll(); inventoryPanel.filterThings(findField.getText()); findPanel.getParent().invalidate(); findPanel.getParent().validate(); } }
/** * Run the dialog, as if modal. * @return A boolean <strong>false</strong> if interaction was canceled, * <strong>true</strong> otherwise. */ public boolean prompt() { Frame toplevel = new Frame("Authentication Required"); toplevel.add("Center", this); toplevel.pack(); toplevel.show(); // Set focus to the user name: txtUser.requestFocus(); // Wait for completion, pack up the result, and delete GUI: boolean result = waitForCompletion(); this.user = txtUser.getText(); this.password = txtPassword.getText(); toplevel.hide(); toplevel.dispose(); return result; }
private void onUDP() { if (mode == UDP_MODE) { abort_connection(); return; } else if (mode == ABORT_MODE) { return; } if (proxy == null) { warn("Proxy is not set"); onProxy(); return; } startNetThread(UDP_MODE); udp_button.setLabel("Abort"); connect_button.setEnabled(false); accept_button.setEnabled(false); udp_button.invalidate(); doLayout(); input_text.requestFocus(); }
private void onAccept() { if (mode == LISTEN_MODE) { abort_connection(); return; } else if (mode != COMMAND_MODE) { return; } if (!readHost()) { return; } if (!readPort()) { port = 0; } if (proxy == null) { warn("Proxy is not set"); onProxy(); return; } startNetThread(LISTEN_MODE); accept_button.setLabel("Abort"); connect_button.setEnabled(false); udp_button.setEnabled(false); input_text.requestFocus(); }
public LoginDialog() { super("Naked Objects Login"); AWTUtilities.addWindowIcon(this, "login-logo.png"); setLayout(new GridLayout(3, 2, 10, 10)); setResizable(false); add(new Label("User name:", Label.LEFT)); add(user = new TextField()); user.addKeyListener(this); add(new Label("Password:", Label.LEFT)); add(password = new TextField()); password.addKeyListener(this); password.setEchoChar('*'); add(cancel = new Button(CANCEL_LABEL)); cancel.addActionListener(this); cancel.addKeyListener(this); add(login = new Button(LOGIN_LABEL)); login.addActionListener(this); login.addKeyListener(this); pack(); int width = getSize().width; // getWidth(); int height = getSize().height; // getHeight(); Dimension screen = getToolkit().getScreenSize(); int x = (screen.width / 2) - (width / 2); if ((screen.width / screen.height) >= 2) { x = (screen.width / 4) - (width / 2); } int y = (screen.height / 2) - (height / 2); setLocation(x, y); user.requestFocus(); }