2

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.

6
  • 1
    I think This stackoverflow.com/questions/18037576/… is what your looking for. Commented Jan 13, 2021 at 19:57
  • I am reading from the console, or STDIN Commented Jan 13, 2021 at 20:08
  • Maybe this can help you : stackoverflow.com/questions/59742483/… Commented Jan 13, 2021 at 20:57
  • Unfortunately, that link and the duplacate link as well mention using "raw mode", which I clearly dont want. Commented Jan 13, 2021 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. Commented Jan 13, 2021 at 21:11

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.