Alanmars
Alanmars

Reputation: 1277

How to listen to keyboard events in a console application

Now, I'm developing a command-line application somewhat like bash. For implementing the autocomplete functionality, I must know users have pressed Tab key. But i don't know how to listen to keyboard events in a console application.

any ideas? Thanks in advance.

Upvotes: 3

Views: 3719

Answers (1)

Nicolas Modrzyk
Nicolas Modrzyk

Reputation: 14197

This is slightly more complicated than it looks.

Maybe you should have a look at the jline project that handles everything for you.

Upvotes: 1

Related Questions