🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #9103

Re: processing animated gifs in JLabel

#9103
From: Alan Shiers
Date: Wed, 24 May 2000 00:00
73 lines
3543 bytes
--------------C9690D44A128842B43984A4F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi Trejkaz:
    I'm not quite sure I follow you.  The two lines of code, as seen below,
are within a mouseClick event.

URL url = getClass().getResource("images/explode.gif");
//'opponent' is an instance of JGrid
opponent.setIconAt(new ImageIcon(url), currentRowSelection,
currentColSelection);

Regardless of the function that runs these lines, the URL's scope is only
alive for the length of time the function is running.  Therefore, doesn't
the URL go dead and disconnect from the file?  Thereby allowing the gif
file to reset itself? And if you notice I create a new instance of the
ImageIcon each and every time the function is called.

Could you show me some sample code to demonstrate what you mean?

Alan

Trejkaz Xaoza wrote:

> Alan Shiers wrote:
> > Does anyone know how to reset the animated gif file after it has been
> > run each and every time?
>
> The ImageIcon class you use to insert the image doesn't appear to have
> any support for animated GIFs.  The easiest method I can think of is
> reconstructing the ImageIcon from the URL each and every time you want
> to use it.  The content for the URL should be cached already, so this
> *shouldn't* make it too much slower.
>
> TX
--------------C9690D44A128842B43984A4F
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
Hi Trejkaz:
<BR>&nbsp;&nbsp;&nbsp; I'm not quite sure I follow you.&nbsp; The two lines
of code, as seen below, are within a mouseClick event.
<P>URL url = getClass().getResource("images/explode.gif");
<BR>//'opponent' is an instance of JGrid
<BR>opponent.setIconAt(new ImageIcon(url), currentRowSelection,
<BR>currentColSelection);
<P>Regardless of the function that runs these lines, the URL's scope is
only alive for the length of time the function is running.&nbsp; Therefore,
doesn't the URL go dead and disconnect from the file?&nbsp; Thereby allowing
the gif file to reset itself? And if you notice I create a <B>new</B> instance
of the ImageIcon each and every time the function is called.
<P>Could you show me some sample code to demonstrate what you mean?
<P>Alan
<P>Trejkaz Xaoza wrote:
<BLOCKQUOTE TYPE=CITE>Alan Shiers wrote:
<BR>> Does anyone know how to reset the animated gif file after it has
been
<BR>> run each and every time?
<P>The ImageIcon class you use to insert the image doesn't appear to have
<BR>any support for animated GIFs.&nbsp; The easiest method I can think
of is
<BR>reconstructing the ImageIcon from the URL each and every time you want
<BR>to use it.&nbsp; The content for the URL should be cached already,
so this
<BR>*shouldn't* make it too much slower.
<P>TX</BLOCKQUOTE>
</HTML>

--------------C9690D44A128842B43984A4F--
Technical Details
Message-ID: <392BFB3D.C2762FBB@istar.ca>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <392948DE.B461A94E@istar.ca> <392B27DE.A7A955AF@darker.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,afd1ac69cd27973e
X-Google-Attributes: gid111d45,public
From: Alan Shiers <jshiers@istar.ca>
Subject: Re: processing animated gifs in JLabel
Date: 2000/05/24
Message-ID: <392BFB3D.C2762FBB@istar.ca>
X-Deja-AN: 626772685
References: <392948DE.B461A94E@istar.ca> <392B27DE.A7A955AF@darker.net>
To: Trejkaz Xaoza <trejkaz@darker.net>
Content-Type: multipart/alternative; boundary="------------C9690D44A128842B43984A4F"
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing