911 */ 912 if( printerJobThread != null && printerJobThread.isAlive() ){ 913 try { 914 printerJobThread.join(); 915 } catch (InterruptedException e) { 916 } 917 } 918 } 919 920 /** 921 * Ends this print job once it is no longer referenced. 922 * @see #end 923 */ 924 public void finalize() { 925 end(); 926 } 927 928 /** 929 * Prints the page at the specified index into the specified 930 * {@link Graphics} context in the specified 931 * format. A <code>PrinterJob</code> calls the 932 * <code>Printable</code> interface to request that a page be 933 * rendered into the context specified by 934 * <code>graphics</code>. The format of the page to be drawn is 935 * specified by <code>pageFormat</code>. The zero based index 936 * of the requested page is specified by <code>pageIndex</code>. 937 * If the requested page does not exist then this method returns 938 * NO_SUCH_PAGE; otherwise PAGE_EXISTS is returned. 939 * The <code>Graphics</code> class or subclass implements the 940 * {@link java.awt.PrintGraphics} interface to provide additional 941 * information. If the <code>Printable</code> object 942 * aborts the print job then it throws a {@link PrinterException}. 943 * @param graphics the context into which the page is drawn 944 * @param pageFormat the size and orientation of the page being drawn 945 * @param pageIndex the zero based index of the page to be drawn 946 * @return PAGE_EXISTS if the page is rendered successfully 947 * or NO_SUCH_PAGE if <code>pageIndex</code> specifies a 948 * non-existent page. 949 * @exception java.awt.print.PrinterException 950 * thrown when the print job is terminated. 951 */ 952 public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) 953 throws PrinterException { 954 955 int result; 956 957 /* This method will be called by the PrinterJob on a thread other 958 * that the application's thread. We hold on to the graphics 959 * until we can rendevous with the application's thread and 960 * hand over the graphics. The application then does all the 961 * drawing. When the application is done drawing we rendevous 962 * again with the PrinterJob thread and release the Graphics 963 * so that it knows we are done. 964 */ 965 966 /* Add the graphics to the message queue of graphics to 967 * be rendered. This is really a one slot queue. The | 911 */ 912 if( printerJobThread != null && printerJobThread.isAlive() ){ 913 try { 914 printerJobThread.join(); 915 } catch (InterruptedException e) { 916 } 917 } 918 } 919 920 /** 921 * Ends this print job once it is no longer referenced. 922 * @see #end 923 */ 924 public void finalize() { 925 end(); 926 } 927 928 /** 929 * Prints the page at the specified index into the specified 930 * {@link Graphics} context in the specified 931 * format. A {@code PrinterJob} calls the 932 * {@code Printable} interface to request that a page be 933 * rendered into the context specified by 934 * {@code graphics}. The format of the page to be drawn is 935 * specified by {@code pageFormat}. The zero based index 936 * of the requested page is specified by {@code pageIndex}. 937 * If the requested page does not exist then this method returns 938 * NO_SUCH_PAGE; otherwise PAGE_EXISTS is returned. 939 * The {@code Graphics} class or subclass implements the 940 * {@link java.awt.PrintGraphics} interface to provide additional 941 * information. If the {@code Printable} object 942 * aborts the print job then it throws a {@link PrinterException}. 943 * @param graphics the context into which the page is drawn 944 * @param pageFormat the size and orientation of the page being drawn 945 * @param pageIndex the zero based index of the page to be drawn 946 * @return PAGE_EXISTS if the page is rendered successfully 947 * or NO_SUCH_PAGE if {@code pageIndex} specifies a 948 * non-existent page. 949 * @exception java.awt.print.PrinterException 950 * thrown when the print job is terminated. 951 */ 952 public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) 953 throws PrinterException { 954 955 int result; 956 957 /* This method will be called by the PrinterJob on a thread other 958 * that the application's thread. We hold on to the graphics 959 * until we can rendevous with the application's thread and 960 * hand over the graphics. The application then does all the 961 * drawing. When the application is done drawing we rendevous 962 * again with the PrinterJob thread and release the Graphics 963 * so that it knows we are done. 964 */ 965 966 /* Add the graphics to the message queue of graphics to 967 * be rendered. This is really a one slot queue. The |