// Stage F: using a WindowListener to handle a window-closing event.
// Barry Cornelius, 19 June 2000
import java.awt.    BorderLayout;
import java.awt.    Container;
import javax.swing. JButton;
import javax.swing. JFrame;
import javax.swing. JTextField;
public class GetDateProg
{
   public static void main(final String[] pArgs)
   {
      final JFrame tJFrame = new JFrame("GetDateProg: Stage F");
      final JTextField tJTextField = new JTextField("hello", 35);
      final JButton tJButton = new JButton("Get Date");
      final JButtonListener tJButtonListener = 
                                  new JButtonListener(tJTextField);
      tJButton.addActionListener(tJButtonListener);
      final Container tContentPane = tJFrame.getContentPane();
      tContentPane.add(tJTextField, BorderLayout.NORTH);
      tContentPane.add(tJButton,    BorderLayout.SOUTH);
      final ExitWindowListener tExitWindowListener =
                                          new ExitWindowListener();
      tJFrame.addWindowListener(tExitWindowListener);
      tJFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
      tJFrame.pack();
      tJFrame.setVisible(true);
   }
}
