-7
Label.setEnabled(true);

if (i == 0) {
    Label.setEnabled(false);
}

If i is equal to 0, it would not be enabled but when I close the program and open it again, it will be enabled instead of staying disabled.

Tiny
  • 27,221
  • 105
  • 339
  • 599
mama chi
  • 7
  • 1

1 Answers1

0

You need to write the current state of the program to a File. See How do I create a file and write to it in Java? on how to do that. Then, when you run the program, it needs to read from that file. You can do that like this:

File f = new File("PATH TO YOUR FILE");
try {
    Scanner s = new Scanner(f);
    String line1 = s.nextLine();
    String line2 = s.nextLine();
    //...
catch (IOException e){}
Community
  • 1
  • 1
James McDowell
  • 2,668
  • 1
  • 14
  • 27