Swing redraw issues (newbie)



  • I've written my first Swing app and all of my logic works properly, but I'm having all kinds of issues with the Swing elements not redrawing properly, especially when elements are added to or removed from a container.

    Does anyone have a link to some kind of FAQ that might help me find the answers to my issues?  (I really don't want to ask anyone here to debug my code; that's not fair to you.)

    I haven't had much luck finding resources that can help me answer my questions.



  • Try (on the level of JFrame):

                    setVisible(true);
                    repaint();





  • while it's nice to not ask us to debug your code, maybe giving a little more specific information would help.  What are you trying to repaint?  what have you tried?

    usually this.repaint() or whatever would o the trick.  if your doing animation or moving objects then you are probably running into problems because the wrong thread is running.  I was having a hell of a time learning animation until I descovered that it should be done under the runnable interface.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.