Article View: borland.public.jbuilder.java.language
Article #19226Re: Problem compiling simple print function
From: Richard Merdinger
Date: Thu, 26 Feb 1998 00:00
Date: Thu, 26 Feb 1998 00:00
52 lines
1608 bytes
1608 bytes
Scott,
It looks like you are using Toolkit in a static fashion. You will
need to access the Toolkit via an instantiated component's
getToolkit() method.
Try something similar to
Printjob job = yourMainFrame.getToolkit().getPrintJob( parentFrame,
"print", null);
hope this helps...
--Rich
Jomax Technologies
rmerdinger@jomax.net
On Wed, 19 Nov 1997 14:40:54 -0700, Scott Van Kirk <scott@mho.net>
wrote:
>Hi,
>
>I have the following function which I call from a class which is a
>descendant of Panel:
>
> public void printImage()
> {
> Frame printFrame = new Frame();
> PrintJob job = Toolkit.getPrintJob( printFrame, "print", null );
> Graphics g = job.getGraphics();
>
> paint(g);
>
> g.dispose();
> job.end();
> printFrame = null;
> }
>
>For some reason, I get the following error in JBuilder:
>
>Error (446) non-static method getPrintJob(java.awt.Frame,
>java.lang.String, java.util.Properties) cannot be referenced from a
>static context.
>
>
>Does anyone have any idea why Jbuilder is considering this a static
>context?
>
>Thanks
>Scott
>
>
Technical Details
Message-ID:
<34f576b9.63412682@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<34735CE5.B4EA8B7A@mho.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,93c189877a446614 X-Google-Attributes: gidf74b3,public From: rmerdinger@jomax.net (Richard Merdinger) Subject: Re: Problem compiling simple print function Date: 1998/02/26 Message-ID: <34f576b9.63412682@forums.borland.com> X-Deja-AN: 328845442 References: <34735CE5.B4EA8B7A@mho.net> Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.language