How can I change the code below to applet?
import java.awt.*;
import java.math.*;
import javax.swing.*;
import java.awt.event.*;
public class Timer extends JFrame
{
JButton start = new JButton("Start/Reset");
JButton stop = new JButton("Stop");
JLabel time = new JLabel("Time");
javax.swing.Timer timer;
int count = 0;
public Timer()
{
super("Timer");
addWindowListener(
new WindowAdapter()
{
public void windowClosing(WindowEvent ev)
{dispose();
System.exit(0);}});
setBounds(10,10,300,150);
getContentPane().setLayout(null);
start.setBounds(10,30,100,24);
start.setBackground(Color.green);
stop.setBounds(10,60,100,24);
stop.setBackground(Color.red);
start.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent e )
{
count = 0;
timer.start();
}
});
stop.addActionListener(
new ActionListener()
{
public void actionPerformed( ActionEvent e )
{
timer.stop();
}
});
time.setBounds(150,30,100,24);
time.setOpaque(true);
time.setBackground(Color.pink);
getContentPane().add(stop);
getContentPane().add(start);
getContentPane().add(time);
timer = new javax.swing.Timer(1000,
new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
count++;
time.setText(" "+count);
}
});
setVisible(true);
}
public static void main (String[] args)
{
new Timer();
}
}