import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;

public class HelloWorldButton implements ActionListener {
	private static String helloWorld = "Hello World !";
	
	public void actionPerformed(ActionEvent arg0) {
		System.out.println(helloWorld);
	}


	public void createGUI() {
		JFrame myFrame = new JFrame(helloWorld);
		JButton myButton = new JButton(helloWorld);

		myButton.addActionListener(this);
		myFrame.getContentPane().add(myButton);
		myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		myFrame.setVisible(true);
		Thread.sleep(3000);
		myFrame.pack();
	}
	
	public static void main(String [] args) {
		new HelloWorldButton().createGUI();
	}
}
