Article View: borland.public.jbuilder.java.language
Article #19664How to create an Image for painting from a non GUI class
From: Morteo, Karl
Date: Mon, 12 Jan 1998 00:00
Date: Mon, 12 Jan 1998 00:00
20 lines
1382 bytes
1382 bytes
I am trying 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 preperation before I can get the Graphics ? If so how ? Any assitance much appreciated, Karl Morteo
Technical Details
Message-ID:
<34B9DF01.952E84A@iee.org>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<01bcd1ba$df068540$93f0adce@seahorse> <VA.000000a5.00778d9c@davidjr> <61jbf5$jht6@forums.borland.com> <343D47D6.39917D05@corp.borland.com> <61jlem$jo56@forums.borland.com> <343E55C3.BF27623D@corp.borland.com> <3465F3D8.A822E39F@nbn.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,cc197c1ee28e2db2 X-Google-Attributes: gidf74b3,public From: "Morteo, Karl" <kmorteo@iee.org> Subject: How to create an Image for painting from a non GUI class Date: 1998/01/12 Message-ID: <34B9DF01.952E84A@iee.org> X-Deja-AN: 315165954 Content-Transfer-Encoding: 7bit References: <01bcd1ba$df068540$93f0adce@seahorse> <VA.000000a5.00778d9c@davidjr> <61jbf5$jht6@forums.borland.com> <343D47D6.39917D05@corp.borland.com> <61jlem$jo56@forums.borland.com> <343E55C3.BF27623D@corp.borland.com> <3465F3D8.A822E39F@nbn.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: None Newsgroups: borland.public.jbuilder.java.language