Article View: borland.public.jbuilder.java.language
Article #19184Re: Printing: I get Print Dialog, but nothing prints!
From: Marc Jourdenais
Date: Wed, 04 Mar 1998 00:00
Date: Wed, 04 Mar 1998 00:00
41 lines
2037 bytes
2037 bytes
Alex, This code is asking the AWT to print all the components in your Frame. What should be printed depends on the components you have added to your Frame before this is called. The components are in turn asked to draw themselves. Since you are doing this before the Frame is shown, you may have some odd behavior. You should be aware that printAll() is in some way broken in most of the VMs out there. JDK1.1.5 has bugs logged against it. So what *should* print is not necessarily what *will* print, even if you code it properly. The peers tend to misbehave in this case. If you just want to print a string, you should call myGraphics.drawString(...), not printAll(...). - Marc Alex Humphreys wrote: > I'm trying to print a string, but for some reason I get Windows' Print > Dialog, but then Nothing Prints. I've tried to follow the instructions > I've found in this newsgroup, and nothing seems to help. > > I have the following in my jbinit of a Frame I just created. the print > dialog comes after the first line, so the Graphics calls don't seem to > do anything. > > PrintJob myJob = > Toolkit.getDefaultToolkit().getPrintJob(this,"AlexH",new Properties()); > Graphics myGraphics = myJob.getGraphics(); > this.printAll(myGraphics); > myGraphics.dispose(); > myJob.end(); > > (incidentally, what should be printed if I do this? an image of the > Frame? A string that I can specify?) > > Thanks. > --Alex
Technical Details
Message-ID:
<34FDCFC6.2CF368E1@pcn.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<34FDB70E.5A5784F6@sema4.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,56b3af2cddf188a7 X-Google-Attributes: gidf74b3,public From: Marc Jourdenais <mjourden@pcn.com> Subject: Re: Printing: I get Print Dialog, but nothing prints! Date: 1998/03/04 Message-ID: <34FDCFC6.2CF368E1@pcn.com> X-Deja-AN: 330878720 Content-Transfer-Encoding: 7bit References: <34FDB70E.5A5784F6@sema4.com> Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language