在 JPanel 中创建 Java 命令控制台

2022-01-23 00:00:00 command console prompt java

我想创建一个类似于 Windows 命令提示符的命令控制台",其中包含 JPanel 中的命令历史记录等,以便可以将其添加到 JFrame.

I want to create a "Command Console" similar to the Windows Command Prompt, with command history, etc which is in a JPanel so that it can be added to a JFrame.

我想要做的是向用户显示允许他们执行命令的提示.

What I want to do is present the user with the prompt to allow them to execute commands.

我的想法类似于 BeanShell 控制台,但是我无法找到控制台的源代码.

What I have in mind is similar to the BeanShell Console, however I haven't be able to find the source code for the console.

推荐答案

要将 BeanShell 包含到您的应用程序中,请添加 BeanShell 下载页面 到您的 Java 项目并查看 BeanShell 文档部分从您的应用程序调用 Beanshell" 以了解如何通过直接调用或通过评估您的 shell 中的命令来调用 Beanshell.

To include BeanShell into your application, add the .jar-files from the BeanShell download page to your Java project and see the BeanShell doc section "Calling Beanshell from your Application" for examples how to call Beanshell with direct calls or by evaluating the commands from your shell.

另请参阅快速入门指南了解如何使用的其他方式和示例豆壳.

See also the Quickstart Guide for other ways and examples how to use BeanShell.

相关文章