SegFault SegFault - 3 months ago 41
Java Question

Console IO for Java applet

I have a console based (
based) Java standalone application. I am trying to convert it into an applet. But the problem is that there is no console in Java applet! In other words, when I write to system output it is not displayed to the user and similarly I am unable to get input from user in absence of a console.

I know that a console lookalike can be done using
, but for that I would need two different components, one for input and one for output. I want the input and output to go into the same component. Any ideas?


But there is a standard console for Java applets :)

Joking aside, there does seem to be some console code on this site: Apparently you can just extend this class and it'll give you a console in your applet. However, you may need to redirect System.out (standard output), System.err (error output) and (input) into the console. That doesn't seem to be implemented but could be blocked in applets by the SecurityManager.