double ratioFix = 1; int w = (int) (ratioFix * pageWidth * scale / 100); int h = (int) (ratioFix * pageHeight * scale / 100);  int pageIndex = 1; Component[] comps = getPreviewContainer().getComponents(); for (int k = 0; k < comps.length; k++) { if (!(comps[k] instanceof PagePreview)) continue;  getStatusLabel().setText("Rendering page "+pageIndex+"..."); Thread.yield();  PagePreview pp = (PagePreview) comps[k]; pp.setScaledSize(w, h);  getStatusLabel().setText("Rendering page "+(pageIndex++)+"...Done."); Thread.yield(); }  getStatusLabel().setText("Rendering done.");  getPreviewContainer().doLayout(); getPreviewContainer().getParent().getParent().validate();
		public void run() {			PrinterJob job = PrinterJob.getPrinterJob();			PageFormat pf = Page.getPageFormat();			PageFormat pf2 = job.pageDialog(pf);						if (pf!=pf2)			{				Page.setPageFormat(pf2);				loadPreview();			}		}