JTF > Demo Gallery > acm.graphics > TwoConsoleDemo

This program illustrates the use of multiple IOConsole objects in the same application and serves largely as a testbed for various features of the IOConsole class. On each side, the user can type lines of text, which then appear on the other console, as in a traditional “chat” program. The color of the input text in each console is set to an identifying color (blue or magenta), and the text from that console appears on the opposite side in the same color by displaying it as an error message with the appropriate color set. The most important feature to observe is that the IOConsole class allows concurrent operation so that output and input operations do not interfere.