I have a pictorial JLabel which I want it changed during the program code. Apparently, when I set it to a new pic, it does not refresh. How do I refresh it?
Sample Code Extract -------------------- JFrame j = new JFrame(); JPanel jp = new JPanel(); JLabel jl = new JLabel(new ImageIcon(ImageIO.read(new File("c:/1.gif"))); j.add(jp); jp.add(jl); j.show(); //Some waiting here, the panel does not show 2.gif. jl = new JLabel(new ImageIcon(ImageIO.read(new File("c:/2.gif")));