Hi my application animation keeps flickering I would put my code in but I keep getting this
package starLogoMain; import java.awt.Color; import java.awt.Graphics; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.JFrame; import javax.swing.Timer; public class StarLogoMain extends JFrame implements ActionListener { /** * */ private static final long serialVersionUID = 1L; private BufferedImage[] image; private Timer timer; private int counter; public StarLogoMain() { // TODO Auto-generated constructor stub super(); setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); getContentPane().setBackground( Color.BLACK ); loadImage(); timer = new Timer( 250, this ); timer.start(); setSize( 500, 500 ); setVisible( true ); } public void loadImage() { try { image = new BufferedImage[ 6 ]; for( int i = 0; i < image.length; i++ ) { image[ i ] = ImageIO.read( new File( "C://Users//Genesis//Desktop//cv//Game Menu Designs//" + "StarLogo Menu//Star Startup Menu Design//AnimationReferences//StarLogo//starLogo1 " + (i + 1) + ".png" ) ); } } catch( IOException io ) { System.out.println( "Cannot Find Images: " + io ); } } public BufferedImage[]getLoadedImages() { return image; } @Override public void paint( Graphics g ) { super.paint( g ); if( getLoadedImages()[ counter ] != null ) { g.drawImage( getLoadedImages()[ counter ], this.getWidth() / 2 - 150, this.getHeight() / 2 - 100, null ); Toolkit.getDefaultToolkit().sync(); } } @Override public void actionPerformed( ActionEvent e ) { // TODO Auto-generated method stub if( counter < 5 ) { counter = counter + 1; } else { counter = 0; } repaint(); } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub new StarLogoMain(); } }