public void printJob ( PrinterJob job ) { Frame frame = this . getFrame ( ) ; dialog = new PrintDialog ( frame , false ) ; dialog . pack ( ) ; if ( frame != null ) this . centerDialogInFrame ( dialog , frame ) ; Map < String , Object > map = new Hashtable < String , Object > ( ) ; map . put ( "job" , job ) ; SyncPageWorker thread = new SyncPageWorker ( dialog , map ) { public void runPageLoader ( ) { Thread swingPageLoader = new Thread ( "SwingPageLoader" ) { public void run ( ) { ( ( PrintDialog ) m_syncPage ) . setVisible ( true ) ; } } ; SwingUtilities . invokeLater ( swingPageLoader ) ; } public void afterPageDisplay ( ) { Thread swingPageLoader = new Thread ( "SwingPageLoader" ) { public void run ( ) { try { PrinterJob job = ( PrinterJob ) get ( "job" ) ; job . print ( ) ; } catch ( PrinterException ex ) { ex . printStackTrace ( ) ; } ( ( PrintDialog ) m_syncPage ) . setVisible ( false ) ; } } ; SwingUtilities . invokeLater ( swingPageLoader ) ; } } ; thread . start ( ) ; }
Print this job .