FileDocCategorySizeDatePackage
JTextFieldExample.javaAPI DocExample625Mon Nov 09 12:45:50 GMT 1998None

JTextFieldExample

public class JTextFieldExample extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

    
    final JTextField field = new JTextField(20);
    field.setHorizontalAlignment(SwingConstants.RIGHT);

    field.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent ev) {
        System.out.println("Entered: " + field.getText());
      }
    });

    JFrame frame = new JFrame();
    frame.addWindowListener(new BasicWindowMonitor());
    frame.getContentPane().add(field);
    frame.pack();
    frame.setVisible(true);