• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help with a image animation applet

 
hennie louw
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i'm makeing an simple animation applet useing differnt
gif's but when I try to run it it says
java.lang.IllegalArgumentException: adding a window to a container
at java.awt.Container.addImpl(Container.java:336)
at java.awt.Container.add(Container.java:228)
at AtlanticFlameLogo.init(AtlanticFlameLogo.java:23)
at sun.applet.AppletPanel.run(AppletPanel.java:344)
at java.lang.Thread.run(Thread.java:484)

heres the code for it , plase help
public class AtlanticFlameLogo extends JApplet implements Runnable
{
private URL logoFile ;
private Image logo;
private Thread runner = null;
private Color bgColor = new Color(0,0,0);
private Graphics g;

public void init()
{
try
{
logoFile = new URL("//");
}catch(MalformedURLException e)
{ }
}/* End of public void init() */

public void start()
{
runner = new Thread(this);
runner.start();
}/* End of public void start() */

public void stop()
{
runner = null;
} /* End of public stop */



public void destroy()
{
logoFile = null;
logo = null;
bgColor = null;
System.gc();
}/* End of public void destroy */

public void run()
{
Thread runingT = Thread.currentThread();
while(runingT == runner);
try
{
for(int i = 0 ; i < 12 ; i++)
{
logo = getImage(logoFile ,"img"+i+".gif");
repaint();
Thread.sleep(100);
}//end of for
}
catch(InterruptedException e)
{ }//end of catch
}//end of public void run


public void paint(Graphics g)
{
g.drawImage(logo, 0 ,0 ,this);
}// End of public void paint(Grahpics g)



}//end of applet
[This message has been edited by hennie louw (edited July 03, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic