Adding a Terminal into a swing application

半世苍凉 提交于 2019-12-20 04:03:08

问题


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 ?

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


回答1:


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?



来源:https://stackoverflow.com/questions/9179329/adding-a-terminal-into-a-swing-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!