Eu tenho esta animaçăo rodando em um aplicativo, como faço para transforma-la em um Applet ?
Já tentei de tudo, alguém pode me ajudar?
 
 
// LogoAnimator.java
 
package jhtp3beans;
 
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import javax.swing.*;
import java.applet.Applet;
 
public class LogoAnimator extends Applet implements ActionListener{
   protected ImageIcon images[];
   protected int totalImages = 5,
                 currentImage = 0,
                 animationDelay = 150;
   protected Timer animationTimer;
 
   public LogoAnimator()
   {
      setSize( getPreferredSize() );
 
      images = new ImageIcon[ totalImages ];
 
      URL url;
 
      for ( int i = 0; i < images.length; ++i ) {
         url = "">                  "feijao" + i + ".gif" );
         images[ i ] = new ImageIcon( url );
      }
 
      startAnimation();
   }
 
   public void paint( Graphics g )
   {
      super.paint( g );
 
      if ( images[ currentImage ].getImageLoadStatus() ==
           MediaTracker.COMPLETE ) {
           g.setColor( getBackground() );
           g.drawRect(
              0, 0, getSize().width, getSize().height );
         images[ currentImage ].paintIcon( this, g, 0, 0 );
         currentImage = ( currentImage + 1 ) % totalImages;
      }
   }
 
   public void actionPerformed( ActionEvent e )
   {
      repaint();
   }
 
   public void startAnimation()
   {
      if ( animationTimer == null ) {
         currentImage = 0; 
         animationTimer = new Timer( animationDelay, this );
         animationTimer.start();
      }
      else
         if ( ! animationTimer.isRunning() )
            animationTimer.restart();
   }
 
   public void stopAnimation()
   {
      animationTimer.stop();
   }
 
   public Dimension getMinimumSize()
   {
      return getPreferredSize();
   }
 
   public Dimension getPreferredSize()
   {
      return new Dimension( 135, 120 );
   }
 
   //public void init(){
   public static void main( String args[] ){
      LogoAnimator anim = new LogoAnimator();
 
      JFrame app = new JFrame( "Feijăo" );
      app.getContentPane().add( anim, BorderLayout.CENTER );
 
      app.addWindowListener(
         new WindowAdapter() {
            public void windowClosing( WindowEvent e )
            {
               System.exit( 0 );
            }
         }
      );
 
      app.setSize( anim.getPreferredSize().width + 10,
                   anim.getPreferredSize().height + 30 );
      app.show();
   }
 

}
 
 
 
 
____________________________________________________
  IncrediMail - O mundo do correio eletrônico finalmente desenvolveu-se - Clique aqui

Responder a