Unit Testing


To test the Printer Management application:

  1. 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; 
  1. 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; 
  1. 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 
  1. To run the Printer Management application, specify the following command at the command prompt:

     java PrintFile 
  1. Click the Print Text tab in the user interface of the Printer Management application.

  2. 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:

    click to expand: this figure shows the printer management application that displays the content of a sample text file.
    Figure 5-5: Printer Management Application Window

  1. Select the File->Page Setup & Print command. The Page Setup dialog box opens, as shown in Figure 5-6:

    click to expand: this figure shows the page setup dialog box that has three panels: paper, orientation, and margins. the paper panel provides fields to specify the size and source of the page. the orientation panel allows the end user to specify the page orientation. the end user can set the page margins using the left, right, top, and bottom text boxes in the margin panel.
    Figure 5-6: Page Setup Dialog Box

  1. 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:

    click to expand: this figure shows printer information, such as status, type, and port type where the printer is connected.
    Figure 5-7: Displaying the Printer Status

  1. Click the Network button to displays all the printers available on the network, as shown in Figure 5-8:

    click to expand: this figure shows all the shared printers that are available in the network. to check the status of each printer, the end user needs to select the appropriate printer from the shared printers list box.
    Figure 5-8: Connect to Printer Dialog Box

  1. Click the OK button on the Page Setup dialog box. A Print dialog box opens, as shown in Figure 5-9:

    click to expand: this figure shows the print dialog box that allows the end user to specify the print range and the number of copies required to be printed.
    Figure 5-9: Print Dialog Box

  1. Click OK to print the current file.

  2. Click the Print Image tab. The image view of the Printer Management application appears, as shown in Figure 5-10:

    click to expand: this figure shows the print image tabbed pane in the printer management application window.
    Figure 5-10: Printer Management Application with Print Image Tabbed Pane

  1. Select File->Open to open an image in the Print Image tabbed pane, as shown in Figure 5-11:

    click to expand: this figure shows a sample image in the print image tabbed pane of the printer management application window.
    Figure 5-11: Displaying an Image File in the Print Image Tabbed Pane

  1. 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:

    click to expand: this figure shows the book interface dialog box that displays a book in the list. in this book, the end user sets the page format of the first two pages as landscape.
    Figure 5-12: Displaying a Book Interface dialog

  1. Click the Print button to print the book items.




Java InstantCode. Developing Applications Using Java NIO
Java InstantCode. Developing Applications Using Java NIO
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 55

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net