Date: Tue, 27 Jan 2004 12:52:50 +1300 From: Jonathan Chen <jonc@chen.org.nz> To: freebsd-java@freebsd.org Subject: Re: JDK1.4.2p6_1 and java.awt.PrintJob Message-ID: <20040126235250.GC28605@grimoire.chen.org.nz> In-Reply-To: <20040126234445.GA28605@grimoire.chen.org.nz> References: <20040126234445.GA28605@grimoire.chen.org.nz>
next in thread | previous in thread | raw e-mail | index | archive | help
--61jdw2sOBCFtR2d/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jan 27, 2004 at 12:44:45PM +1300, Jonathan Chen wrote: > Hi everyone, > > I'm having problems with the printing with JDK1.4.2p6_1. The attached code > used to work sometime ago (with p4?), and works under Windows as expected, > ie Prints 2 pages, with some text. With the latest patchset, I'm > missing the second page. > > Am I missing something here, or did something break? Oops. I really meant to attach this file instead... -- Jonathan Chen <jonc@chen.org.nz> ---------------------------------------------------------------------- The human mind ordinarily operates at only ten percent of its capacity -- the rest is overhead for the operating system. --61jdw2sOBCFtR2d/ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="PrintTest.java" import java.awt.*; public class PrintTest { public static void main ( String args []) { final Font StdFont = new Font ("Monospaced", Font.PLAIN, 10); JobAttributes job = new JobAttributes (); job.setDialog (JobAttributes.DialogType.COMMON); job.setDefaultSelection (JobAttributes.DefaultSelectionType.ALL); PageAttributes page = new PageAttributes (); page.setOrigin (PageAttributes.OriginType.PRINTABLE); PrintJob pj = Toolkit. getDefaultToolkit (). getPrintJob ( null, "Printer", job, page); if (pj == null) { System.out.println ("Quit"); System.exit (1); } Graphics g = pj.getGraphics (); if (g == null) { System.err.println ("Null on pj.getGraphics()"); System.exit (1); } g.setFont (StdFont); g.drawString ("This is a test", 0, 20); g.dispose (); g = pj.getGraphics (); if (g == null) { System.err.println ("Null on pj.getGraphics()"); System.exit (1); } g.setFont (StdFont); g.drawString ("This is the 2nd page", 0, 20); g.dispose (); pj.end (); System.exit (0); } } --61jdw2sOBCFtR2d/--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040126235250.GC28605>