Move printing position of Command Line Interface in Java without using External library

瘦欲@ 提交于 2019-12-06 06:39:02

The ability to do this is a property of the terminal, not the language. So in principal, if you're connected to a sufficiently capable terminal emulator, then yes, of course it's possible.

The purpose of a library like ncurses is to abstract away the gory details of terminal-dependent cursor movement, etc. You don't need something like ncurses, you could always just directly emit the appropriate codes for your target terminal.

By, "is there an equivalent method in Java," do you mean are there libraries which also can provide you terminal-agnostic abstractions? Yes (see the other responses). But nothing is going to make every host system to the JVM provide a VT100 emulator. For example, good luck on Windows. In this sense, 2D graphics in Java are more universal than the terminal environment!

JCurses (Java port of ncurses library from C) is one possibility

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!