将终端添加到swing应用程序 [英] Adding a Terminal into a swing application

查看:92
本文介绍了将终端添加到swing应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用Java开发应用程序,并且希望将终端作为GUI的一部分.是否可以获取系统终端(如果是Windows,则为cmd),并将其作为面板中的GUI的一部分?

I am making an application in java and I want to have a terminal as part of my GUI. Is it possible to get the system terminal (or cmd if windows), and have it as part of my GUI in a panel ?

如果需要,我需要一个类似 http://code.google.com/p/dragonconsole的库/还是有一些获取默认系统终端的默认"方式?谢谢

If so do I need a library like http://code.google.com/p/dragonconsole/ or there is some "default" way of getting the standard system terminal ? Thanks

推荐答案

我不认为Java语言提供了控制台/终端库.但是,您可以使用 Process 运行时 类可模仿所需的行为并与您的本机系统接口,并使用 JTextArea + JTextField 在您的GUI控制台中显示和发布命令.
查看您提供的链接,我想说如果您不想自己编写太多代码,dragonconsole可能是一个不错的选择.无论如何,这取决于您打算使用控制台的目的.但是为什么要重新发明热水呢?

I don't think a console/terminal library is provided by the java language. However, you can use the Process and Runtime classes to mimic the desired behaviour and interface with your native system, and use JTextArea + JTextField for showing and issuing commands in your GUI console.
Looking at the link you provided, I'd say dragonconsole might be a good option if you don't want to code a lot yourself. In any case, it depends on what exactly you intend to use your console for. But why re-invent hot water, right?

这篇关于将终端添加到swing应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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