what are the errors
could you please tell me what are the errors in the program.I cant find any error.But my teacher said me to redo it.
ASSIGNMENT:
Implement a program to display 2 buttons and 3 check boxes in a frame.
Answer
import java.awt.*;
import java.awt.event.*;
public class awt6
{
public static void main(String[] args)
{
Frame f=new Frame("Applet Progrm6");
ActionListener aa=new a();
Checkbox check1=new Checkbox("choice1");
Checkbox check2=new Checkbox("choice2");
Checkbox check3=new Checkbox("choice3");
Panel p1=new Panel();
p1.add(check1);
p1.add(check2);
p1.add(check3);
f.add(p1,BorderLayout.CENTER);
Panel p2=new Panel();
Button b;
p2.add(b=new Button("OK"));
b.setActionCommand("OK");
b.addActionListener(aa);
p2.add(b=new Button("Cancel"));
b.setActionCommand("Cancel");
b.addActionListener(aa);
f.add(p2,BorderLayout.SOUTH);
f.setLayout(new FlowLayout());
f.setSize(300,300);
f.setVisible(true);
f.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
}
}
class a extends awt6 implements ActionListener
{
public void itemStateChanged(ItemEvent ie)
{
}
public void actionPerformed(ActionEvent ae)
{
String s=ae.getActionCommand();
if(s.equals("OK"))
{
System.out.println("OK clicked");
}
if(s.equals("Cancel"))
{
System.out.println("Cancel clicked");
}
}
}