import javax.swing.*; 
import java.awt.event.*;

class Four extends JFrame {
  JButton button = new JButton("Click me!"); 
  JLabel label = new JLabel("Hello, World!"); 

  Four(String title, int width, int height) {
    JPanel panel = new JPanel();  
    panel.add(button); 
    panel.add(label); 
    this.add(panel); 

    button.addActionListener( new Listener() ); 

    this.setSize(width, height); 
    this.setTitle(title); 
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
    this.setVisible(true); 
  }
  public static void main(String[] args) {
    Four f = new Four("Simple Frame", 300, 100); 
  }
}

class Listener implements ActionListener {
  public void actionPerformed(ActionEvent e) {
    System.out.println("Ouch!"); 
  } 
}