hello i am having trouble trying to understand swing timers. to help me could someone show me a simple flickering animation? i have looked arround on the internet but still
maybe this would help:
public class object{
Color color = Color.GREEN;
Timer timer;
public object() {
timer = null;
timer = new Timer(5000, new ActionListener(){
public void actionPerformed(ActionEvent e) {
if (color.equals(Color.GREEN)) {
color = Color.RED;
timer.setDelay(2000);
} else {
color = Color.GREEN;
timer.setDelay(8000);
}
repaint();
}
});
timer.start();}}