java jLabel image does not update -


I am creating a feedback label that shows the user the image selected in the file dialog.

When a picture file is selected, that image will be updated in the picture on which the user clicked.

The first time the picture is selected, it works fine, but when the second picture is selected for the second time, it remains in the form of the first picture.

Code:

  Private Zero jButton3ActionPerformed (java.awt.event.ActionEvent evt) {// Browse button FileDialog fd = New FileDialog (Select this, "Choose a file" , File dialog.load); Fd.setDirectory ("C: \\"); Fd.setFile ("* jpg."); // jpg files only fd.setVisible (true); String file name = fd.getFile (); If (filename == faucet) {System.out.println ("You have opted out"); } Else {savePicture ("temporary"); // Save it in temp.jpg This overwrites an existing image Image Icon imgThisImg = null; ImgThisImg = New Imaging (absfilePath + "/temp.jpg"); JLabel7.setIcon (zero); JLabel7.setIcon (imgThisImg); JLabel7.revalidate (); JLabel7.repaint (); }  

During debugging, the directory image is updated after the moment the save () function is executed. Therefore, it is not a problem with overwriting the file. The file is written correctly, why does it still display the previous image? Is there a cash or something that I want to clean?

Thanks


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -