KevKelders KevKelders - 1 year ago 158
Java Question

Boolean value changing button click

What would be the most simple solution each time a user presses a certain button the bool value changes? The only thing in my button action listener would be a call to a certain method for example Method1();
Or would working with a int be a more viable solution?

Thanks.

Answer Source

Even simpler:

buttonFlag = ! buttonFlag;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download