private void addTextListener(final TextField tf) { tf.addKeyListener(new KeyAdapter() { @Override public void keyTyped(final KeyEvent arg0) { try { final Matrix4f m = fromFields(); matrixTA.setText(InteractiveTransformDialog.this.toString(m)); transformationUpdated(m); } catch (final Exception e) { System.out.println(e.getMessage()); } } }); }
public IntegerAttributeEditor() { widget = new TextField(); widget.addKeyListener(new IntegerListener()); origs = ""; } }
public DoubleAttributeEditor() { widget = new TextField(); widget.addKeyListener(new DoubleListener()); origs = ""; } }
public LongAttributeEditor() { widget = new TextField(); widget.addKeyListener(new LongListener()); origs = ""; } }
sentenceField.addKeyListener(new KeyListener()
private TextField addField() { final TextField tf = new TextField(10); tf.addFocusListener(this); tf.addKeyListener(this); tf.setEditable(true); panel.add(tf); return tf; }
/** Create a series of text fields labeled with no label */ protected TextField [] createXYZField(Panel p, String [] d, int i) { Panel xyz = new Panel(); xyz.setLayout(new GridLayout(0, d.length)); TextField [] t = new TextField[d.length]; for (int j = 0; j < d.length; j++) { t[j] = new TextField(""+d[j], i); t[j].setEditable(true); xyz.add(t[j]); t[j].addKeyListener(this); } p.add(xyz); return (t); } // Create a series of text fields with one label (useful for vectors)
tf.addTextListener(this); tf.addFocusListener(this); tf.addKeyListener(this); numberField.addElement(tf); sliderIndexes.add(new Integer(numberField.size()-1));
/** * Create a text field with default content "d" of length i (in characters), labeled by "s". * @param p the panel to which the text field will be added. * @param label the label of the textfield. * @param defaultContents the default contents of the text field. * @param nrChars the length in characters of the text field. * @return the Textfield that was created. */ protected TextField createTextField(Panel p, String label, String defaultContents, int nrChars) { Label l = new Label(label+" ", Label.RIGHT); p.add(l); TextField t = new TextField(""+defaultContents, nrChars); t.setEditable(true); p.add(t); t.addKeyListener(this); return (t); } /**
protected TextField [] createXYZField(Panel p, String s, String [] d, int i) { Label ll = new Label(s+" ", Label.RIGHT); p.add(ll); Panel xyz = new Panel(); xyz.setLayout(new GridLayout(0, d.length)); TextField [] t = new TextField[d.length]; for (int j = 0; j < d.length; j++) { t[j] = new TextField(""+d[j], i); t[j].setEditable(true); xyz.add(t[j]); t[j].addKeyListener(this); } p.add(xyz); return (t); } /** Create a series of text fields labeled with no label */
public IPTextField() { IntegerListener intlistener = new IntegerListener(this); IPListener iplistener = new IPListener(this); fields = new TextField[4]; for (int i=0; i < fields.length; i++) { fields[i] = new TextField(3); fields[i].addTextListener(iplistener); fields[i].addKeyListener(intlistener); } setLayout( new GridLayout(1,4) ); add(fields[0]); add(fields[1]); add(fields[2]); add(fields[3]); }
protected TextField [] createXYZField(Panel [] p, String s, String [] d, int i) { Label ll = new Label(s+" ", Label.RIGHT); p[0].add(ll); Panel xyz = new Panel(); xyz.setLayout(new GridLayout(0, d.length)); TextField [] t = new TextField[d.length]; for (int j = 0; j < d.length; j++) { t[j] = new TextField(""+d[j], i); t[j].setEditable(true); xyz.add(t[j]); t[j].addKeyListener(this); } p[1].add(xyz); return (t); } /** Create a choice item, fill it with d strings and preselect item i. */
tf.addTextListener(this); tf.addFocusListener(this); tf.addKeyListener(this); c.gridx = GridBagConstraints.RELATIVE; c.anchor = GridBagConstraints.WEST;
tf.addTextListener(this); tf.addFocusListener(this); tf.addKeyListener(this); c.gridx = GridBagConstraints.RELATIVE; c.anchor = GridBagConstraints.WEST;
tf.addTextListener(this); tf.addFocusListener(this); tf.addKeyListener(this); numberField.addElement(tf); defaultValues.addElement(new Double(defaultValue));
tf.addActionListener(this); tf.addFocusListener(this); tf.addKeyListener(this); tf.setEditable(true); stringField.addElement(tf);
findField.setForeground(SystemColor.controlText); findField.setVisible(true); findField.addKeyListener(new FindFieldKeyListener()); findField.addTextListener(new FindFieldTextListener());
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(); final int width = getSize().width; // getWidth(); final int height = getSize().height; // getHeight(); final Dimension screen = getToolkit().getScreenSize(); int x = (screen.width / 2) - (width / 2); if ((screen.width / screen.height) >= 2) { x = (screen.width / 4) - (width / 2); } final int y = (screen.height / 2) - (height / 2); setLocation(x, y); user.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(); }
prompt = new TextField("", 32); prompt.addTextListener(this); prompt.addKeyListener(this); northPanel.add(prompt); dialog.add(northPanel, BorderLayout.NORTH);