Nur die besten Spiele ;3
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
676 B

package Minesweeper;
import java.util.Timer;
import java.util.TimerTask;
import javax.swing.JLabel;
public class TimerLable extends JLabel {
private static final long serialVersionUID = 1L;
private int counter = 0;
public void start() {
Timer timer = new Timer();
TimerTask task = new Helper(this);
timer.schedule(task, 0, 1000);
}
public void update() {
setText(String.valueOf(++counter));
}
}
class Helper extends TimerTask
{
public static int i = 0;
private TimerLable timerLable;
public Helper(TimerLable _timerLable) {
timerLable = _timerLable;
}
public void run()
{
timerLable.update();
}
}