Как увеличить счетчик (локальную переменную) при нажатии JButton (Java Swing)? ⇐ JAVA
-
Гость
Как увеличить счетчик (локальную переменную) при нажатии JButton (Java Swing)?
It doesn't let me saying it should be final or effectively final.
Here's a snippet:
int hrs = 0; JButton plus = new JButton(); plus.addActionListener(e -> hrs++); How do I increase hrs? (I want it to be a local variable in main)
Источник: https://stackoverflow.com/questions/780 ... java-swing
It doesn't let me saying it should be final or effectively final.
Here's a snippet:
int hrs = 0; JButton plus = new JButton(); plus.addActionListener(e -> hrs++); How do I increase hrs? (I want it to be a local variable in main)
Источник: https://stackoverflow.com/questions/780 ... java-swing
Мобильная версия