在Java中获取文本用户界面(类似ncurses)功能的最佳方法是什么? [英] What's the best way to get text user-interfaces (ncurses-like) functionality in Java?

查看:486
本文介绍了在Java中获取文本用户界面(类似ncurses)功能的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要实现一个具有类似ncurses功能的控制台应用程序(可能是Java)(例如导航菜单并重新绘制整个屏幕)。

I need to implement a console application (possibly in Java) with ncurses-like functionality (such as navigating a menu and redrawing the whole screen).

唯一到目前为止我能找到的解决方案是CHARVA(Java Windowing Toolkit for文本终端),tuipeer(Java AWT的文本用户界面)和真是老Dobb博士的文章(Java AWT
的文本用户界面
) 。

The only solutions that I can find to do this so far are CHARVA ("A Java Windowing Toolkit for Text Terminals"), tuipeer ("A Text User Interface for the Java AWT") and a really old Dr. Dobb's article ("A Text UI for the Java AWT ").

到目前为止,CHARVA是我能找到的最好的东西,但我不喜欢使用JNI包装诅咒的想法。

So far, CHARVA is the best thing that I can find but I don't like the idea of it using JNI to wrap curses.

有没有标准的方法,比如用AWT / Swing来做这个?还有什么其他选择?

Is there any standard way, say with AWT/Swing, to do do this? What other alternatives are there?

推荐答案

自2010年以来,Lanterna就有了:

Since 2010 there is Lanterna :

Lanterna是一个Java库,允许您在纯文本环境中编写简单的半图形用户界面,非常类似于C库curses但具有更多功能。 Lanterna支持xterm兼容终端和终端仿真器,如konsole,gnome-terminal,putty,xterm等等。 lantern的主要好处之一是它不依赖于任何本地库,而是在纯Java中运行100%。

Lanterna is a Java library allowing you to write easy semi-graphical user interfaces in a text-only environment, very similar to the C library curses but with more functionality. Lanterna is supporting xterm compatible terminals and terminal emulators such as konsole, gnome-terminal, putty, xterm and many more. One of the main benefits of lanterna is that it's not dependent on any native library but runs 100% in pure Java.

更多信息: https://github.com/mabe02/lanterna

这篇关于在Java中获取文本用户界面(类似ncurses)功能的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆