I have the next code:
for(int i = 0; i < fileRefernces.size(); i++) {
Thread t = new Thread(new Runnable() {
public void run() {
JLabel pageNumber = new JLabel("<html><font color='#003b86'>PAGE" + (i + 1) + "</font></html>", JLabel.LEFT);
JLabel imageLabel = new JLabel(image, JLabel.LEFT);
// content would be probably some Image class or byte[]
// or:
// InputStream in = Loc.openStream();
// read image from in
}
});
}
But, just at the moment to assign the value, I get the next error:
error: local variables referenced from an inner class must be final or effectively final
How I can assign values to those variables?