keyboard - Simple key listener - java -


I have a code inside an infinite loop. I would like to apply a method which checks whether I press a button or not as a loop breaker.

  while (true) {... if (this.escapeKeyIspressed ()) // If really the escape on that millisecond then ...}}   

What is the easiest way to do this in Java?

P

presents a method to set the console in non-intercept mode to read , Which you can use to break your loop. It also presents some other methods for both Python and Java, but it is considered to be a little laughing and non-portable (for example, Windows will not work under). I do not think there is a 'good' easy way to do this. I'm scared.

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -