//HelloFrame //Hello world as a basic GUI //Andy Harris, 06/00 import java.awt.*; import java.awt.event.*; public class HelloFrame extends Frame { Label lblHi = new Label("Hello, world!!"); EventHandler evt = new EventHandler(); public static void main(String args[]){ HelloFrame hf = new HelloFrame(); } // end main public HelloFrame(){ super("Hello!!"); setLayout(new BorderLayout()); add(lblHi, BorderLayout.CENTER); lblHi.setFont(new Font("SansSerif", Font.BOLD, 30)); lblHi.setForeground(Color.blue); lblHi.setBackground(Color.white); setSize(300, 300); setVisible(true); pack(); addWindowListener(evt); } // end constructor private class EventHandler extends WindowAdapter{ public void windowClosing(WindowEvent e){ Window theWindow = (Window)e.getSource(); theWindow.setVisible(false); theWindow.dispose(); System.exit(0); } // end windowClosing } // end EventHandler class def } // end main class def