0

I am making a Java program that get arrow keys and characters as input without pressing enter, I have searched the web, and the only "solution" was putting the TTY in raw mode. I do not want to do that, since that does not work on windows.

EDIT: I am read from the console. Scanner and System.in does not return data until Enter is pressed.

HAHALOSAH
  • 88
  • 7
  • 1
    I think This https://stackoverflow.com/questions/18037576/how-do-i-check-if-the-user-is-pressing-a-key is what your looking for. – LeCandyCorn Jan 13 '21 at 19:57
  • I am reading from the console, or STDIN – HAHALOSAH Jan 13 '21 at 20:08
  • Maybe this can help you : https://stackoverflow.com/questions/59742483/java-how-to-get-user-input-without-pressing-the-enter-key – Traian GEICU Jan 13 '21 at 20:57
  • Unfortunately, that link and the duplacate link as well mention using "raw mode", which I clearly dont want. – HAHALOSAH Jan 13 '21 at 21:03
  • The problem is that you are wanting to do a very low-level operating system function. Java isn't good at that because it can't be done in a way that is consistent across platforms. Most gui frameworks can do this because they do interface with the os at that level, but console input doesn't. – NomadMaker Jan 13 '21 at 21:11
  • is there a "raw mode" for windows? – HAHALOSAH Jan 13 '21 at 21:25

0 Answers0