仅输入到端子的底线 [英] Input only to bottom line of terminal

查看:91
本文介绍了仅输入到端子的底线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用Java制作了一个命令行聊天客户端,该客户端将消息从stdin发送到服务器,同时又从服务器接收消息到stdout.您可能在写消息时有人发送了一条消息,所以我希望终端的底线始终保留给输入,以便输出显示在消息的上方. 希望您能理解我的问题,如果不明白,请提前向您道歉.

I made a command-line chat client with Java, that sends the messages from stdin to the server and, at the same time, receives messages from the server to stdout at the same time. It's likely that somebody may send a message while you're writing one, so I want the bottom line of the terminal always reserved for input, so that output appears above it. I hope you understand my question and I apologize in advance if you don't.

推荐答案

JCurses库将完全满足您的需求.

The JCurses library will do exactly what you need.

http://sourceforge.net/projects/javacurses/

这是来自* nix操作系统的ncurses的Java实现.在Windows上,您需要包括.dll文件,在大多数linux发行版中,除了在类路径中包含jar之外,您无需执行任何其他操作.

It's a Java implementation of ncurses from the *nix operating systems. On Windows, you'll need to include the .dll files, on most linux distros, you don't need to do anything except include the jar in your classpath.

之所以需要一个库来构建命令行gui",是因为标准Java无法以这种方式操作本地命令行.这可能是由于Java不是为特定平台构建的-只是一个猜测.

The reason you need a library to build a "command line gui" is because standard java is not capable of manipulating the local command line in this fashion. This is likely due to how Java is not built for a specific platform - but that's just a guess.

这篇关于仅输入到端子的底线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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