PPT Slide
import javax.swing.*; import java.awt.event.*;
public class StopWatch extends JLabel implements ActionListener{
super("Elapsed Time: 0 secs", JLabel.CENTER);
Timer t = new Timer(1000, this); t.start();
public void actionPerformed(ActionEvent e){
this.setText("Elapsed Time: " + count++ + " secs");
public static void main (String arg[]){
f.addWindowListener (new WindowAdapter()
{ public void windowClosing(WindowEvent e){
StopWatch c = new StopWatch();
.setLayout(new BorderLayout());
.add(c, BorderLayout.CENTER);