import java.awt.*;import java.awt.*;
import javax.swing.*;import javax.swing.*;
public class SomeEvents extends JFrame {public class SomeEvents extends JFrame {
public static void main(String[] args) { public static void main(String[] args) {
// Construct an instance of this class and show it // Construct an instance of this class and show it
SomeEvents window = new SomeEvents(); SomeEvents window = new SomeEvents();
window.setVisible(true); window.setVisible(true);
} }
// A graphical component to be "listened" to // A graphical component to be "listened" to
private JButton aButton; private JButton aButton;
public SomeEvents() { public SomeEvents() {
layoutGUI(); layoutGUI();
} }
private void layoutGUI(); private void layoutGUI();
// Lay out the GUI, initialize instance variables // Lay out the GUI, initialize instance variables
// Have this object send some messages to itself // Have this object send some messages to itself
this.setSize(200, 100); this.setSize(200, 100);
this.setTitle("Listen to button"); this.setTitle("Listen to button");