🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #19130

Re: Printing: I get Print Dialog, but nothing prints!

#19130
From: Alex Humphreys
Date: Mon, 09 Mar 1998 00:00
54 lines
2564 bytes
Bugs?  What bugs?

Is there a way to get it to work if I know the operating system (we're
exclusively using windows 95 and NT)?  Is there another way to print the
screen as a graphic (I'd rather not convert everything to a String)?

Help!  It worked fine in JBuilder but when I ran it as a stand-along I
printed up some sort of random jarble of all that I wanted to print.

Thanks.

Marc Jourdenais wrote:

> 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: <35045370.600D19B5@sema4.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <34FDB70E.5A5784F6@sema4.com> <34FDCFC6.2CF368E1@pcn.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: Alex Humphreys <ahumphreys@sema4.com>
Subject: Re: Printing:  I get Print Dialog, but nothing prints!
Date: 1998/03/09
Message-ID: <35045370.600D19B5@sema4.com>
X-Deja-AN: 332384103
Content-Transfer-Encoding: 7bit
References: <34FDB70E.5A5784F6@sema4.com> <34FDCFC6.2CF368E1@pcn.com>
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language