FileDocCategorySizeDatePackage
TextEntryBox.javaAPI DocExample1060Mon May 01 14:41:56 BST 2000None

TextEntryBox

public class TextEntryBox extends JFrame

Fields Summary
Constructors Summary
public TextEntryBox()

    super("TextEntryBox v1.0");
    setSize(200, 300);
    setLocation(200, 200);

    final JTextArea area = new JTextArea(  );
    area.setFont(new Font("Serif", Font.BOLD, 18));
    area.setText("Howdy!\n");
    final JTextField field = new JTextField(  );

    Container content = getContentPane(  );
    content.add(new JScrollPane(area), BorderLayout.CENTER);
    content.add(field, BorderLayout.SOUTH);
    setVisible(true);
    field.requestFocus(  );

    field.addActionListener(new ActionListener(  ) {
      public void actionPerformed(ActionEvent ae) {
        area.append(field.getText(  ) + '\n");
        field.setText("");
      }
    });
  
Methods Summary
public static voidmain(java.lang.String[] args)

    JFrame f = new TextEntryBox(  );
    f.addWindowListener(new WindowAdapter(  ) {
      public void windowClosing(WindowEvent we) { System.exit(0); }
    });
    f.setVisible(true);