Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / January 2006

Tip: Looking for answers? Try searching our database.

Animated GIFs corrupt when inserted to JTextPane

Thread view: 
Allan Bruce - 21 Jan 2006 00:06 GMT
I have some code to add animated GIFs to a JTextPane but unfortunately they
come out corrupted.  Can anybody tell me how to solve this?  I have added
the smallest code that exhibits this behaviour below.

Thanks
Allan

import java.net.URL;
import javax.swing.*;

public class EmotTester
{
   public EmotTester()
   {
       JFrame lFrame = new JFrame("Test");
       JTextPane lTP = new JTextPane();
       lFrame.getContentPane().add(lTP);
       lFrame.pack();
       lFrame.setVisible(true);
       lFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

       try
       {
           URL lFileURL = this.getClass().getResource("test.gif");
           lTP.insertIcon(new ImageIcon(lFileURL));
       }
       catch (Exception e)
       {
           System.out.println("Exception: " + e);
       }
   }

   public static void main(String [] args)
   {
       new EmotTester();
   }
}
IchBin - 21 Jan 2006 00:46 GMT
> I have some code to add animated GIFs to a JTextPane but unfortunately they
> come out corrupted.  Can anybody tell me how to solve this?  I have added
> the smallest code that exhibits this behaviour below.
>
> Thanks
> Allan

[snip code]

Sorry Allen, I ran you code,  with an animated gif on my machine under
Eclipse 3.2, with no problem.

Signature

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)

IchBin - 21 Jan 2006 00:50 GMT
>> I have some code to add animated GIFs to a JTextPane but unfortunately
>> they come out corrupted.  Can anybody tell me how to solve this?  I
[quoted text clipped - 7 lines]
> Sorry Allen, I ran you code,  with an animated gif on my machine under
> Eclipse 3.2, with no problem.

My java version 1.5.0_06 (build 1.5.0_06-b05)
Signature


Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)

Allan Bruce - 21 Jan 2006 01:31 GMT
>>> I have some code to add animated GIFs to a JTextPane but unfortunately
>>> they come out corrupted.  Can anybody tell me how to solve this?  I have
[quoted text clipped - 9 lines]
>>
> My java version 1.5.0_06 (build 1.5.0_06-b05)

Hmm, I have tested a few gifs and some work, yet some are corrupt.  The ones
which display corrupted can be viewed in any other package without a
problem.  My tested gifs are from yahoo messenger, the laughing one in
particular displays the problem to a tee.  I have tested this with Java1.5
on windows and 1.4 on MacOs X - same problem on both :-(
Allan
IchBin - 21 Jan 2006 04:28 GMT
>>>> I have some code to add animated GIFs to a JTextPane but unfortunately
>>>> they come out corrupted.  Can anybody tell me how to solve this?  I have
[quoted text clipped - 16 lines]
> on windows and 1.4 on MacOs X - same problem on both :-(
> Allan

Don't have an answer. If the images were that important enough that I
really wanted to use them. Well, I would load them in to say Photoshop
or Gimp and look under their hoods to see what was gong on. Being that
some work and some do not.

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)
Allan Bruce - 21 Jan 2006 04:30 GMT
>> Hmm, I have tested a few gifs and some work, yet some are corrupt.  The
>> ones which display corrupted can be viewed in any other package without a
[quoted text clipped - 6 lines]
> Gimp and look under their hoods to see what was gong on. Being that some
> work and some do not.

I have had a look with advanced gif animator and nothing seems untoward -
never mind, I need to make my own anyway, so I'll just ensure they work when
I make them...

Allan


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.