I would like to use a Swing Timer, in a Java class that extends Applet, like the following:
timer = new Timer(100, new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
// change polygon data
// ...
repaint();
}
});
I am using the timer to rotate different drawn polygons, when I click on the area where a polygon is drawn.
My question is where to insert the above code to create a timer? In the init() method or somewhere else?
Timerininit()Timerinstart()Timerinstop()