import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class ActionFramework extends JFrame implements ActionListener
{
// public variables and objects
JLabel display = new JLabel();
JButton exitButton = new JButton("EXIT");

Timer clock = new Timer( 1000, null );

FlowLayout layout = new FlowLayout();

int seconds = 0;

// constructor
public ActionFramework()
{	
setSize(400, 200);
setLocation(50,50);
setDefaultCloseOperation(EXIT_ON_CLOSE);

setLayout( layout );

add( display );

clock.addActionListener( this );
clock.start();

add( exitButton );
exitButton.addActionListener( this );

setVisible(true);	
}
	
public void actionPerformed (ActionEvent e )
   {
	if (e.getSource() == clock)
	   {
      seconds++;
      display.setText( String.valueOf(seconds) );	
	   }
	if (e.getSource() == exitButton)
	   {
	   System.exit(0);	
      }
   }
	
public static void main(String args [] )
   {
   new ActionFramework();	
   } // end main
	
} // end class

