Thursday 15 March 2012

java - LinkedList of BufferedImage -



java - LinkedList of BufferedImage -

i trying optimize animation class i've built using tutorial nullpointerexception whenever seek add together bufferedimage linkedlist of type bufferedimage.

this code:

public class animation { private int speed; private int frames; private int index = 0; private int count = 0; private linkedlist<bufferedimage> img; private bufferedimage currentimg; public animation(int speed, bufferedimage img1, bufferedimage img2) { this.speed = speed; img.add(img1); img.add(img2); } }

why can't add together bufferedimage linkedlist?

you need create new linkedlist before adding images it

right simply declaring pointer it, img null when seek add together it.

img = new linkedlist<bufferedimage>();

java animation linked-list bufferedimage

No comments:

Post a Comment