How do I prevent multiple instances of the Scanner class from running? There is information about threads & locks etc but I cannot get them to work on my application. For example, I click on Pay, then an instance of Scanner appears, then Cancel which creates Pay. Then when I click on Pay, the number of Scanner(s) doubles. Heres a short summary:How do I prevent multiple instances of the Scan