It's my first question there so please don't be so cruel .
I've got problem with my program , it means i don't know why i have got NullpointerException , anybody knows why ?
My code : `package ex2;
public class Screen extends JPanel {
private BufferedImage image ;
private Timer tm ;
private Graphics g ;
private static int index = 0 ;
private ArrayList<String> paths = new Test().getArrayList();
public Screen(){
System.out.println(paths);
String interval ;
interval = JOptionPane.showInputDialog("Please write time interval "
+ "between images in miliseconds");
tm = new Timer(Integer.parseInt(interval), new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
paint(index);
index += 1 ;
if (index >= paths.size())
System.exit(index);
} catch (IOException e1) {
e1.printStackTrace();
}
}
});
tm.start();
}
public void paint(int i) throws IOException{
image = ImageIO.read(new File(paths.get(i)));
g.drawImage(image, 40, 30, image.getWidth() , image.getHeight() , null);
}
}