🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

REPOST: How to create an Image for painting from a non GUI class

#19684
From: Morteo, Karl
Date: Tue, 13 Jan 1998 00:00
23 lines
1285 bytes
Last time I posted this it didn't seem to make it to the list so I'm
trying again...

I am attempting to create a non GUI class with a function the same as
Component.createImage(int width, int height). 

The image is created with a call like this 

        image = Toolkit.getDefaultToolkit().createImage(new
MyImageSource(width, height));

I am using a dummy MyImageSource even though I actually want an empty
width by height image. All seems well unless I try to get the image
'Graphics' with a call to image.getGraphics() which always generates a
class cast exception.

Do I need to perform some kind of image initialisation or preparation
before I can get the Graphics ? If so how ?

Any assistance much appreciated,

Karl Morteo
Technical Details
Message-ID: <34BB700A.E8907597@iee.org>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <34BACD0E.FC2CB1B1@erols.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,345399f298d9f135
X-Google-Attributes: gidf74b3,public
From: "Morteo, Karl" <kmorteo@iee.org>
Subject: REPOST: How to create an Image for painting from a non GUI class
Date: 1998/01/13
Message-ID: <34BB700A.E8907597@iee.org>
X-Deja-AN: 315536508
Content-Transfer-Encoding: 7bit
References: <34BACD0E.FC2CB1B1@erols.com>
Content-Type: text/plain; charset=us-ascii
Organization: None
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language