public void playAnimation(){
        for(BufferedImage bi : images) {
            ActionListener animate = new ActionListener() {

                private int index = 0;

                @Override
                public void actionPerformed(ActionEvent e) {
                    if (index<images.length-1) {
                        index++;
                    } else {
                        index = 0;
                    }
                    animation.setIcon(new ImageIcon(images[index]));
                }
            };

            final Timer timer = new Timer(frameRate,animate);
            ActionListener startStop = new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    if (b.isSelected()) {
                        timer.start();
                    } else {
                        timer.stop();
                    }
                }
            };
            b.addActionListener(startStop);

        }//end for
    }//end playAnimation