Java Source Code
Required Auxiliary Files
This section lists many of the extra source files that are required by various examples in the previous sections, along with a description of each file. The files listed here are those which are general enough to be useful in other programming projects.
- TextIO.java which defines a class containing some static methods for doing input/output. These methods make it easier to use the standard input and output streams, System.in and System.out.
- TicketMachine class, the class to play with.
- TextIO.class, the compiled version of TextIO.java.
- ConsoleApplet.java, a class that can be used as a framework for writing applets that do console-style input/output. To write such an applet, you have to define a subclass of ConsoleApplet. See the source code for details. Several examples of applets created using ConsoleApplet are available above. Any project that uses this class also requires ConsolePanel.java and ConsoleCanvas.java.
- ConsolePanel.java, a support class that is required by any project that uses ConsoleApplet.
- ConsoleCanvas.java, a support class that is required by any project that uses ConsoleApplet or Console.
- Console.java, which defines a subclass, Console, of Frame that can be used for standalone applications that use console-style input/output. This class makes use of the ConsoleCanvas class, which is also used by the console-style applets in Chapters 2 and 3. This class is not used by any examples in the text, but all the examples that use TextIO can be converted to use Console instead. For information on how to do the conversion, see the example in ConsoleFrameThreeN1.java.
- SimpleAnimationApplet.java, a class that can be used as a framework for writing animated applets. To use the framework, you have to define a subclass of SimpleAnimationApplet. Section 2.6 explains how to do this.
- MosaicFrame.java which defines a subclass of Frame for implementing colored "mosaics," as in Section 3.6. (When you compile this file, you'll get two classes: MosaicFrame.class and MosaicFrame$1.class.) MosaicFrame.java depends on MosaicCanvas.java.
- MosaicCanvas.java, a subclass of the built-in Canvas class that implements a grid of colored squares.
- MessageDialog.java, a class for displaying modal dialogs that contain a message and one, two, or three buttons. From Section 6.5.
- TextReader.java, which contains the definition of the FilterReader discussed in Section 8.2.