001package horstmann.ch04_frame;
002import java.awt.FlowLayout;
003
004import javax.swing.JButton;
005import javax.swing.JFrame;
006import javax.swing.JTextField;
007
008public class FrameTester
009{
010        public static void main(String[] args)
011        {
012                JFrame frame = new JFrame();
013
014                JButton helloButton = new JButton("Say Hello");
015                JButton goodbyeButton = new JButton("Say Goodbye");
016
017                final int FIELD_WIDTH = 20;
018                JTextField textField = new JTextField(FIELD_WIDTH);
019                textField.setText("Click a button!");
020
021                frame.setLayout(new FlowLayout());
022
023                frame.add(helloButton);
024                frame.add(goodbyeButton);
025                frame.add(textField);
026
027                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
028                frame.pack();
029                frame.setVisible(true);
030        }
031}