Source of FrameTester.java


  1: import java.awt.*;
  2: import javax.swing.*;

  4: public class FrameTester
  5: {
  6:    public static void main(String[] args)
  7:    {
  8:       JFrame frame = new JFrame();

 10:       JButton helloButton = new JButton("Say Hello");
 11:       JButton goodbyeButton = new JButton("Say Goodbye");

 13:       final int FIELD_WIDTH = 20;
 14:       JTextField textField = new JTextField(FIELD_WIDTH);
 15:       textField.setText("Click a button!");

 17:       frame.setLayout(new FlowLayout());

 19:       frame.add(helloButton);
 20:       frame.add(goodbyeButton);
 21:       frame.add(textField);

 23:       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 24:       frame.pack();
 25:       frame.setVisible(true);
 26:    }
 27: }