1

I'm writing a Java applet in Eclipse. When I click on the button in the applet, it should display a message, but the message won't actually show up until I fiddle with the applet window, like resizing the window. Is there something I should add in my code, so the GUI automatically updates once I click the button?

Jenn
  • 11
  • 1

1 Answers1

0

generally a call to repaint() will take care of that.


based on mre's comments, this has better information: Java Swing revalidate() vs repaint()
Community
  • 1
  • 1
jcomeau_ictx
  • 37,688
  • 6
  • 92
  • 107
  • nice how you got rid of your comment which postdated mine and which also advised repaint(), then gave me a -1 when the OP advised you that it didn't work. – jcomeau_ictx Jun 21 '11 at 20:28
  • 1
    uh-huh. my policy is to never downvote an answer that was given in good faith, no matter how wrong, but of course you may do as you please. at least you had the honor to claim the vote and not do it anonymously. why don't you post the correct answer so that the question can be marked solved? – jcomeau_ictx Jun 21 '11 at 21:06
  • @jcomeau_ictx, So you promote misinformation? -- cool. Why don't you revise your answer and make it correct? You can use my own words, if you'd like. ;) – mre Jun 21 '11 at 21:08
  • it isn't misinformation. generally a call to repaint() solves problems like the one posted, at least for me. I never had to use validate() before. I'm grateful to you for teaching me this, and I'm not going to steal your answer. – jcomeau_ictx Jun 21 '11 at 21:12