I've been trying to update a BufferedImage that is inserted to a GUI by using the Swing Timer. Initially I created the ImageIcon using the BufferedImage I get through a controller instance and then added it to JLabel (field). The current image was then shown on the GUI. Here a code snippet from the initial code inside the GUI class.
I’m trying now to get a BufferedImage every x seconds . For this purpose I used the Swing Timer class but unfortunately I haven’t been able to suceed. I created the following class with an ActionListener, so that every 3 seconds a new image is retrieved with the method getCameraImage.
Here the UpdateImage with the ActionListener class:
After the BufferedImage has been set as an ImageIcon I retrieve it with the getLabel method. And then add this component to the GUI.
The
String "image update" shows up as desired every 3 seconds on the console. But the image won’t be diplayed on the GUI.
I'd really appreciate if someone could help me out on that by giving me some sort of hint or pointing out what I'm doing wrong.
Thank you.