public TripsPreviewFrame(Frame parentWindow, final Printable pr, final PageFormat p, boolean formSheetAvailable) {
		super(parentWindow, "Print Preview");
		setModal(true);
		this.formSheetAvailable = formSheetAvailable;

		this.pg = new Pageable() {
			@Override
			public int getNumberOfPages() {
				Graphics g = new java.awt.image.BufferedImage((int)p.getImageableWidth(),(int)p.getHeight(),java.awt.image.BufferedImage.TYPE_INT_RGB).getGraphics();
				
//	System.out.println (p.getWidth() + "/" + p.getHeight());
				
//				Graphics g = new java.awt.image.BufferedImage(2,2,java.awt.image.BufferedImage.TYPE_INT_RGB).getGraphics();
				int n=0;
				try { while(pr.print(g, p, n) == Printable.PAGE_EXISTS) n++; }
				catch(Exception ex) {ex.printStackTrace();}
				g.dispose();
				return n;
			}
			@Override public PageFormat getPageFormat(int x) { return p; }
			@Override public Printable getPrintable(int x) { return pr; }
		};
		createPreview();
	}