The problem is about the "int amount". I'm trying to create a system where every couple seconds an amount is added to the start amount.
public static void main(String[] args) {
final int WIDTH = 600;
final int HEIGHT = 600;
int amount = 0;
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
int amount = amount + 1;
}
}, 2*1000, 2*1000);
JFrame frame = new JFrame("TimerTest");
frame.setVisible(true);
frame.setSize(WIDTH, HEIGHT);
frame.setResizable(false);
frame.setLayout(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLabel label = new JLabel("");
label.setText(String.valueOf(amount));
frame.add(label);
}
}