I am trying to create a text-based game in Java similar to Zork and put it on a web server after I’m done and so I have decided to make the program an applet. My question is this: How do I display and input strings that are normally displayed through System.out.println and System.in? I know that I can create a JPanel and display text through a JTextArea but I want the console to be emulating a terminal like the one I am currently using shown here:
http://farm8.staticflickr.com/7082/6879721298_323e72cc92_z.jpg
Is there any way to add a frame that will display the emulator inside of it or incorporate a console to display the strings outputted by the System.out.println?
It is technically possible to redirect the system
in,err&outstreams, but note that it requires a trusted app. (digitally signed by the developer, user clicks ‘OK’ when prompted at the scary dialog) to do it. OTOH it would be better to design1 a different version of the software for a GUI that puts the output directly into a text area or similar (for output) & accepts it from a text field (for input).Another alternative for a sand-boxed app. (very kludgy, but possible), is to log the output to the anonymous logger. Add a log handler to retrieve that output and display it. Using logging does solve app. output, but not user input.
I now note the screen-shot says ‘Dragon Console’. How does that differ in functionality from the Windows ‘Command Prompt’?