🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Problem compiling simple print function Solved

#19966
From: Scott Van Kirk
Date: Wed, 19 Nov 1997 00:00
38 lines
1306 bytes
You need to instantiate the toolkit with:

PrintJob job = Toolkit.getDefaultToolkit().getPrintJob(...

--------------------

Scott Van Kirk 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: <34735EBE.62855074@mho.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <34735CE5.B4EA8B7A@mho.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,ec4de8ce9d5c7111,start
X-Google-Attributes: gidf74b3,public
From: Scott Van Kirk <scott@mho.net>
Subject: Re: Problem compiling simple print function Solved
Date: 1997/11/19
Message-ID: <34735EBE.62855074@mho.net>
X-Deja-AN: 290827892
References: <34735CE5.B4EA8B7A@mho.net>
Organization: None
Newsgroups: borland.public.jbuilder.java.language