javaswingterminal

Adding a Terminal into a swing application


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


Solution

  • 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?