To test the Printer Management application:
Set the path of the bin directory of J2SDK by executing the following command at the command prompt:
set path=%path%;D:\j2sdk1.4.0_02\bin;
Set the classpath of the lib directory of J2SDK by executing the following command at the command prompt:
set classpath = %classpath%;d:\j2sdk1.4.0_02\lib;
Copy the PrintFile.java, PrintComp.java, and CreateBookInterface.java files to a folder on your computer. On the command prompt, use the cd command to move to that folder where you have copied the Java files. Compile the files using the following javac command:
javac *.java
To run the Printer Management application, specify the following command at the command prompt:
java PrintFile
Click the Print Text tab in the user interface of the Printer Management application.
Select the File->Open command from the File menu of the Printer Management Application. Browse and open the text file that is to be printed using the Open dialog box. The selected file appears in JTabbedPane, as shown in Figure 5-5:
Figure 5-5: Printer Management Application Window
Select the File->Page Setup & Print command. The Page Setup dialog box opens, as shown in Figure 5-6:
Figure 5-6: Page Setup Dialog Box
Click the Printer button on the Page Setup dialog box. A new Page Setup dialog box appears, which displays the name , status, type and location of the current printer, as shown in Figure 5-7:
Figure 5-7: Displaying the Printer Status
Click the Network button to displays all the printers available on the network, as shown in Figure 5-8:
Figure 5-8: Connect to Printer Dialog Box
Click the OK button on the Page Setup dialog box. A Print dialog box opens, as shown in Figure 5-9:
Figure 5-9: Print Dialog Box
Click OK to print the current file.
Click the Print Image tab. The image view of the Printer Management application appears, as shown in Figure 5-10:
Figure 5-10: Printer Management Application with Print Image Tabbed Pane
Select File->Open to open an image in the Print Image tabbed pane, as shown in Figure 5-11:
Figure 5-11: Displaying an Image File in the Print Image Tabbed Pane
Select File->Print->Print Default to print the current page. Select File->Print->Print Custom to print a customized book, as shown in Figure 5-4. When the end user selects the page format using the Page Format check box and specifies the number of pages in Number of Pages test box of the Book Interface dialog box. Now, clicks the Add in the Book button in the Book Interface dialog box. The results are displayed in the list box of the Book Interface, as shown in Figure 5-12:
Figure 5-12: Displaying a Book Interface dialog
Click the Print button to print the book items.