Results 1 to 6 of 6
  1. #1
    goatjugsoup is offline Member
    Join Date
    May 2012
    Posts
    15
    Rep Power
    0

    Default How can you stop flicker on image change?

    Hi, I have created an application that has a class extended from JPanel that lets me change image being displayed with overriding draw method. Every time a button is pressed the image being displayed in that panel will change. When this happens there is a very noticable flicker.
    I thought it might have been because I am overriding paint in that one customised JPanel class but I commented it out and the issue happens all the same when an image would have been changed.

    If anyone could help me figure this out that would be very helpful. I tried to detail the situation so that I wouldn't need to post any code but if the case is that I do just say so.

    It's not quite what's going on in this link
    JAVA CODE SPOT: JAVA : Flickering Problem In Paint Method, it only happens when the button that would change the pic is clicked.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,332
    Rep Power
    25

    Default Re: How can you stop flicker on image change?

    Can you make a small program that compiles, executes and show the problem?
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    goatjugsoup is offline Member
    Join Date
    May 2012
    Posts
    15
    Rep Power
    0

    Default Re: How can you stop flicker on image change?

    I don't have time to do that until after tomorrow but if thats what I need to do to be helped I will do it then. Thanks for the reply.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default Re: How can you stop flicker on image change?

    Quote Originally Posted by goatjugsoup View Post
    Hi, I have created an application that has a class extended from JPanel that lets me change image being displayed with overriding draw method.
    JPanel doesn't have a draw method.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    goatjugsoup is offline Member
    Join Date
    May 2012
    Posts
    15
    Rep Power
    0

    Default Re: How can you stop flicker on image change?

    I did a quick google search and this link is kinda like what I'm doing
    Java Swing: how to add an image to a JPanel? - Stack Overflow
    If JPanel doesn't have a draw method what is it overriding then?

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,332
    Rep Power
    25

    Default Re: How can you stop flicker on image change?

    Can you make a small program that compiles, executes and show the problem?
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Change background image
    By Jeffrod in forum AWT / Swing
    Replies: 2
    Last Post: 08-12-2011, 02:14 AM
  2. change image
    By mysa in forum Java Applets
    Replies: 7
    Last Post: 09-01-2010, 03:51 PM
  3. Change dimension of image
    By cselic in forum AWT / Swing
    Replies: 3
    Last Post: 08-29-2010, 09:23 PM
  4. Use stop button to stop moving (stop timers) on JPanel
    By mneskovic in forum New To Java
    Replies: 3
    Last Post: 07-23-2010, 12:50 PM
  5. Javascript change image
    By butsags in forum New To Java
    Replies: 1
    Last Post: 12-10-2009, 11:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •