H, I have the code:
int delay = 0; .
int period = 5;
Timer timer = new Timer();
//...
timer.scheduleAtFixedRate(new TimerTask() {
public void run() {
Calcule();
SchimbaPeriod();
repaint();
}
}, delay, period);
//...
public void SchimbaPeriod()
{period=period+r.nextInt(3) - 1;
if (period==3) period=4;
if (period==21) period=20;
}
But that dosnt change speed of timer, probably because it takes period only when timer is initiated.
What would be the way to that?