🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #3527

Re: CreateImage(w,h) in a Java Application?

#3527
From: Andrew Bennett
Date: Mon, 15 Dec 1997 00:00
41 lines
1785 bytes


S.T. wrote:

> Hey,
>
> I seem to be having trouble using CreateImage(w,h) in a Java
> application.  It seems when I try the applet version of my program,
> everything works fine.  When I embed the same applet in a frame in my
> application, the CreateImage() call returns NULL, and everything else
> blows up.
>
> The line of code I'm working with is similar to:
>
> offScreenImage = createImage(width, height);        //this line fails in
> an application
> offScreenGraphic = offScreenImage.getGraphics();
>
> (Yes, it's double buffering.)
>
> Any ideas, or do I need to create an image in an application another
> way?

java.awt.Component is abstract, so you'll need to subclass the call
to something.

From Java in a Nutshell 1.1, page 361 "In a standalone application,
the URL.getContent() method can be used to obtain an ImageProducer
object, which can then be passed to the Component.createImage()
method to obtain an Image object."


Hope that helps!

Andrew
--
  Andrew Bennett            ->  abennett@borland.com
  JBuilder info             ->  http://www.borland.com/jbuilder/
  JBuilder newsgroups info  ->  http://www.borland.com/newsgroups/
**** Please don't post a reply AND send email.  Do one.  I'll see it. ****
Technical Details
Message-ID: <3495A420.71DCDA02@borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <34942E67.EE92E8A2@whc.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,114f8832447813b5
X-Google-Attributes: gid1089d0,public
From: Andrew Bennett <abennett@borland.com>
Subject: Re: CreateImage(w,h) in a Java Application?
Date: 1997/12/15
Message-ID: <3495A420.71DCDA02@borland.com>
X-Deja-AN: 298485185
Content-Transfer-Encoding: 7bit
References: <34942E67.EE92E8A2@whc.net>
Content-Type: text/plain; charset=us-ascii
Organization: None
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.api