Construct the object including its GUI
super("GUIextendsFrame");
setLayout(new FlowLayout());
add(new Label("Hello, and welcome to the world of Java"));
add(quitButton = new Button("Exit"));
quitButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setVisible(false);
dispose();
System.exit(0);
}
});
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
setVisible(false);
dispose();
System.exit(0);
}
});
pack();