🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.api
6 messages
6 total messages Started by George Boutwell Sat, 14 Sep 2002 17:48
ImageIcon equivalent in AWT
#834
Author: George Boutwell
Date: Sat, 14 Sep 2002 17:48
12 lines
1278 bytes
I need to get an application working for PersonalJava 1.2.  It has a 
bunch of Swing stuff... I've gotten past most of that (I've only dabbled 
in Java from time to time.)  But for the life of me I can't seem to 
replace this:

private ImageIcon pacman = new ImageIcon("pacman.gif");

What would be it's equivalent in AWT?

Thanks,

George
Re: ImageIcon equivalent in AWT
#835
Author: John McGrath TeamB
Date: Sat, 14 Sep 2002 18:54
16 lines
1326 bytes
On Sat, 14 Sep 2002 12:48:13 -0500, George Boutwell wrote:

> private ImageIcon pacman = new ImageIcon("pacman.gif");
> 
> What would be it's equivalent in AWT?

There is no direct equivalent, but the closest thing is an Image.

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Re: ImageIcon equivalent in AWT
#836
Author: George Boutwell
Date: Sat, 14 Sep 2002 22:18
16 lines
1536 bytes
Thanks John.  I figured that much out.  But every attempt I made at 
trying to use Image complained about it being an abstract class, or 
plain old didn't work.  I guess I'll go bang my head against the wall 
some more.

George

John McGrath [TeamB] wrote:


>>private ImageIcon pacman = new ImageIcon("pacman.gif");
>>
>>What would be it's equivalent in AWT?
> 
> 
> There is no direct equivalent, but the closest thing is an Image.
Re: ImageIcon equivalent in AWT
#837
Author: John McGrath TeamB
Date: Sat, 14 Sep 2002 23:07
23 lines
1892 bytes
On Sat, 14 Sep 2002 17:18:59 -0500, George Boutwell wrote:

> But every attempt I made at trying to use Image complained
> about it being an abstract class, or plain old didn't work.
> I guess I'll go bang my head against the wall some more.

The implementations of Image are platform-specific, so you do not 
instantiate them in your code.  You use the createImage() factory 
method in the Toolkit class to create them.

Depending on how you are using the image, you may need to use a 
MediaTracker to ensure that the image has been loaded.  This does 
not happen when you create the image -- the image data is loaded 
when needed.

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Re: ImageIcon equivalent in AWT
#838
Author: George Boutwell
Date: Sun, 15 Sep 2002 03:37
27 lines
2165 bytes
John McGrath [TeamB] wrote:
> On Sat, 14 Sep 2002 17:18:59 -0500, George Boutwell wrote:
> 
> 
>>But every attempt I made at trying to use Image complained
>>about it being an abstract class, or plain old didn't work.
>>I guess I'll go bang my head against the wall some more.
> 
> 
> The implementations of Image are platform-specific, so you do not 
> instantiate them in your code.  You use the createImage() factory 
> method in the Toolkit class to create them.
> 
> Depending on how you are using the image, you may need to use a 
> MediaTracker to ensure that the image has been loaded.  This does 
> not happen when you create the image -- the image data is loaded 
> when needed.

I'm starting to see why they have an IconImage in swing... :)

Thanks for you help.  I'm pretty sure you've given me enough new things 
I hadn't tried that I can figure it out.  At least I'll try and let you 
know how it comes out.

George

George
Re: ImageIcon equivalent in AWT
#848
Author: Tor Iver Wilhelmsen (TeamB)
Date: Sun, 22 Sep 2002 14:41
9 lines
1212 bytes
George Boutwell <gboutwel@netscape.net> writes:

> private ImageIcon pacman = new ImageIcon("pacman.gif");
> 
> What would be it's equivalent in AWT?

A custom Component holding a reference to an Image and using its
properties for getSize() etc., painting the image onto itself in
paint().
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads