对于终端应用程序来说,什么是一个好的类似于诅咒的 Java 库?

我想编写一个 Java 终端应用程序来进行屏幕操作。有没有什么好的库可以让你像 * nix/C 世界里的诅咒一样操纵屏幕?

我要寻找的最小特性是窗口和用户输入支持。

用功能语言来说,我希望在终端的某个区域定期更新一些数据,同时用户可以在屏幕的其他部分输入命令/文本。

83757 次浏览

Haven't used it myself, but Java Curses Library sounds like what you want.

There is Charva, which links to native code but has an api based on Swing. The screenshots show lots of text windows, so that looks useful.

Here is a way to call the ncurses lib using JNI. I tested this and it works.

Lanterna

I found the Lanterna library recently. Haven't had the opportunity to use it yet but it looks like a more up-to-date alternative to the others.

enter image description here

As of 2013, the closest I can find is Blacken.

Blacken is not a curses library per-se. It moves away from the terminal, and instead, renders it's own "console window." This has the disadvantage of not looking "console-like." Instead, you get full (arbitrary) colour support, and a curses-like API (in addition to their main API).

You can also set the font to Mono for fixed-width characters.