-
Bug
-
Resolution: Fixed
-
P4
-
1.3.0
-
beta
-
sparc
-
solaris_7
Name: skT45625 Date: 08/30/2000
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-RC)
Java HotSpot(TM) Client VM (build 1.3.0-RC, mixed mode)
Hi,
If animated GIF is <1M, animation is correct in Java and in Netscape browser.
If animated GIF is >1M, animation will stop in Java. It will run correctly in
the Netscape browser.
I have tried the code, with overriding update and using media tracker, neither
will work with animated GIFS >1M. I am including the media tracker code. You
will need to create an animated GIF >1M. I used ImageMagick.
Jim
//////////////////////////////////////////////////////////////
import java.awt.event.*;
import java.awt.*;
public class TestFrame {
public static void main(String args[]) {
new TestFrameFrame();
}
}
class TestFrameFrame extends Frame {
Image im;
TestFrameFrame() {
super();
/* Get the animated GIF */
im = Toolkit.getDefaultToolkit().ginsertCDge("world.gif");
MediaTracker mt = new MediaTracker(this);
mt.addImage(im,1);
try{mt.waitForAll();}
catch(InterruptedException ie){}
/* Add the window listener */
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
dispose(); System.exit(0);}});
/* Size the frame */
setSize(200,200);
/* Center the frame */
Dimension screenDim =
Toolkit.getDefaultToolkit().getScreenSize();
Rectangle frameDim = getBounds();
setLocation((screenDim.width - frameDim.width) /
2,(screenDim.height - frameDim.height) / 2);
/* Show the frame */
setVisible(true);
}
public void update(Graphics g)
{
paint(g);
}
public void paint(Graphics g)
{
g.drawImage(im,getInsets().left,getInsets().top,this);
}
}
(Review ID: 109133)
======================================================================