简体   繁体   English

Java GUI中的命令行界面

[英]Command line interface within Java GUI

I want to implement a command line interface within the Java GUI window. 我想在Java GUI窗口中实现命令行界面。 Is there a good way of doing this or an existing project/example I could use? 有没有一个很好的方法来做这个或我可以使用的现有项目/示例?

My application visualises a graph in the GUI and I would like to enter verbal commands for editing it, instead of developing a point-and-click interface for every possible command. 我的应用程序在GUI中可视化图形,我想输入语音命令进行编辑,而不是为每个可能的命令开发一个点击式界面。 It would be similar to a normal command line but I would have a custom parser that analyses the entered command strings. 它类似于普通的命令行,但我会有一个自定义解析器来分析输入的命令字符串。

  • You can write your command and press enter, upon which the string is sent to a listener for parsing and execution. 您可以编写命令并按Enter键,将字符串发送到侦听器以进行解析和执行。
  • Show a scrollable history of previous commands. 显示先前命令的可滚动历史记录。
  • After parsing I might want to print something onto the screen (which would go to the history area). 解析后,我可能想在屏幕上打印一些东西(可以进入历史区域)。
  • Perhaps a command-line-style prefix (">"). 也许是命令行样式前缀(“>”)。
  • Ability to edit the current command (backspace) before submitting it (enter). 能够在提交之前编辑当前命令(退格)(输入)。 Not being able to delete the prefix or previous commands in the history. 无法删除历史记录中的前缀或上一个命令。
  • Up and down keys would allow navigating and repeating previous commands. 上下键将允许导航和重复先前的命令。

You have the Groovy Console . 你有Groovy控制台 See the paragraph Embedding the Console for your app swing. 请参阅嵌入控制台的段落了解您的应用程序摆动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM