I want to create an applet with a face-drawing game with buttons to change the parts of the face, but I don't know how to use the setVisible(false)
to make e.g. an Oval to disappear inside the action listener while it is declared inside the paint method block.
//import necessary packages
public class applet1 extends Applet implements ActionListener
{
Button b;
init()
{
b=new Button("Oval face");
b.addActionListener(this);
add(b);
}
public void paint(Graphics g)
{
g.drawOval(50,50,50,50);
}
public void actionPerformed(ActionEvent ae)
{
g.setVisible(false); //I know this line cannot be executed but I jast want to show the idea!
}
}