package cse1030.Mar05;

import javax.swing.*;

import java.awt.*;
import java.awt.event.*;

public class MyJFrame 
extends JFrame
implements ActionListener
{
	private static final int WIDTH = 600; // pixels
	private static final int HEIGHT = 400;
	
	private JLabel myLabel = new JLabel("Hello World!");
	private JButton myButton = new JButton("Click me!");
	
	public MyJFrame() {
		super.setTitle("CSE 1030");
		super.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		super.setSize(MyJFrame.WIDTH, MyJFrame.HEIGHT);
		
		super.setLayout(new FlowLayout());
		
		super.add(this.myButton);
		super.add(this.myLabel);
		
		myButton.addActionListener(this);
		
		super.setVisible(true);

	}
	
	public void actionPerformed(ActionEvent e) {
		myLabel.setText("Clickety click");
		super.setTitle("You clicked the button!");
	}

	
	public static void main(String[] args) {  new MyJFrame(); }
		
}
