• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Swing Timer update BufferedImage

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Quit cross posting: http://stackoverflow.com/questions/30143955/using-swing-timer-to-update-bufferedimage-on-gui/30144038#30144038

You got your answer in this posting before you even posted your question here.
 
C. Eche
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's true. thank you for that.
I just wanted to exhaust every possibility.
Nothing wrong with that.
 
Rob Camick
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Nothing wrong with that.



Yes, there is. The problem with cross posting is people never bother to reply to all the posting stating the question has been answered or reposting the answer on the other postings so that all people know what the solution is.

It is annoying to spend time answering a question only to find out the same answer has already been given.

We don't have unlimited time to answer questions, so out time is better spend answering questions that don't have an answer.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic