I had something to get a local file and lookmed around a little bit and this is working for me:
public static void changeIcon2(URL adress,JLabel imageLabel) throws JavaLayerException, IOException, InterruptedException {
imageLabel.setVisible(false);
BufferedImage temp = ImageIO.read(adress);
imageLabel.setIcon(new ImageIcon(temp));
imageLabel.setVisible(true);
}
Simply call it in you Code where you need it.
So - your problem (i ran into it, too) you have to use URL not File.
But what i am using in my Program to read local files (it is a bit specific for my project):
public static void changeIcon(String championname,JLabel imageLabel) throws JavaLayerException, IOException, InterruptedException {
imageLabel.setVisible(false);
ImageIcon temp = new ImageIcon(getLolPath()+"\\League of Legends\\rads\\projects\\lol_air_client\\releases\\"+currentVersion+"\\deploy\\assets\\images\\champions\\"+championname+"_Square_0.png");
imageLabel.setIcon(temp);
imageLabel.setVisible(true);
}