animaçao de imagens

oi pessoal, sou novato nesse assunto e gostaria de uma ajuda , é o seguinte:
eu quero fazer uma animaçao de imagens, mas estou tendo muitos problemas na hora de carregar as imagens.
se alguem puder da uma ajuda ficarei grato. se tiverem alguma sugestao para estudar tambem agradeço! vlw!
codigo q peguei de um livro:

protected void initializeanimacao()
{

	images = new ImageIcon[ TOTAL_IMAGES ];
	for (int count = 0; count < images.length; ++count )
	images [count] = new ImageIcon( getClass().getResource("images/" + 
	IMAGE_NAME + count + ".gif"));
	
	width = images[ 0 ].getIconWidth();
	height = images[ 0 ].getIconHeight();

	}

é nesse metodo que estou tendo problemas.

Quais problemas?

ja indentifiquei o problema , acho q tinha haver com o diretorio (“images/” ). modifiquei os parametros q estavam dentro do for e deu certo,
so substitui o :

for (int count = 0; count < images.length; ++count )
images [count] = new ImageIcon( getClass().getResource(“images/” +
IMAGE_NAME + count + “.gif”));

por:

for (int count = 0; count < images.length; count++ )
images [count] = new ImageIcon( getClass().getResource((
IMAGE_NAME + count+ “.gif”)));

e funciou.

Vc colocou elas em um Array… por acaso o nome “animação” remete a várias fotos sendo mostradas rapidamente dando a ilusão de uma animação???

Como agregou esse trecho do código ao programa pra dar esse efeito de “animação”, mostra pra gente ae!

[]'s

aqui ta o codigo completo :

import java.awt.;
import javax.swing.
;
import java.awt.event.;
//import javax.swing.
;

public class animacao extends JPanel implements ActionListener{

protected String IMAGE_NAME = "image"; 
protected ImageIcon images[]; 
protected int TOTAL_IMAGES = 10, currentImage = 0, ANIMACAO_DELAY = 600//tempo entre
//as imagens
, width, height; 
protected Timer animacaoTimer; 

	
	public animacao()
	{
		initializeanimacao();
	}	

	protected void initializeanimacao()
	{
	images = new ImageIcon[ TOTAL_IMAGES ];
	for (int count = 0; count < images.length; count++ )
	images [count] = new ImageIcon( getClass().getResource(( 

IMAGE_NAME + count+ “.gif”))); //vai carregar as imagens (ex:“image1.gif”)

	width = images[ 0 ].getIconWidth();
	height = images[ 0 ].getIconHeight();
	}
	
	public void paintComponent ( Graphics g )
	{
		super.paintComponent( g );
		images [ currentImage ].paintIcon(this, g, 0, 0);
		currentImage = ( currentImage + 1 ) % TOTAL_IMAGES;
		
	}
	
	public void actionPerformed( ActionEvent actionEvent)
	{
		repaint();
	}
	
	public void startAnimacao()
	{
			if (animacaoTimer == null)
			{
			
			currentImage = 0;
			animacaoTimer = new Timer( ANIMACAO_DELAY, this);
			animacaoTimer.start();
			
			}
		else
		
			if ( !animacaoTimer.isRunning())
				animacaoTimer.restart();

	}
	public void stopAnimacao()
	{
		animacaoTimer.stop();
	}

	public Dimension getMinimumSize()
	{
		return getPreferredSize();
	}

	public Dimension getPreferredSize()
	{
		return new Dimension( width, height );
	}

	public static void main( String args[] )
	{
		animacao animacao1 = new animacao();
		JFrame window = new JFrame( "Testando animacao");
		Container container = window.getContentPane();
		container.add( animacao1 );
		
		window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		window.pack();
		Insets insets = window.getInsets();
		
		window.setSize( animacao1.getPreferredSize().width + insets.left + insets.right, animacao1.getPreferredSize().height + insets.top + insets.bottom);
		window.setVisible( true );
		animacao1.startAnimacao();
	}

}

Deyvison,

Use a tag code para organizar seus fontes.