Java keyboard input parsing in a console app

后端 未结 2 591
梦如初夏
梦如初夏 2021-01-05 00:46

I\'ve just started messing around with JLine to parse character input in console mode. It seems to work well, but I\'m wondering:

Is there a nonblocking way in JLine

2条回答
  •  無奈伤痛
    2021-01-05 01:41

    You can't use a console to get non-blocking input without native libraries.

    You'll have to write a Swing app and write a KeyListener

    Read this tutorial: http://java.sun.com/docs/books/tutorial/uiswing/events/keylistener.html

提交回复
热议问题