I want to start and stop an infinite loop by pressing a key. I have the first part of my code that does the infinite loop:
package test; import java.awt.Robot; p