Question:
Java - validate() repaint() ? How to refresh JFrame?
ryuzog
2009-12-26 18:24:11 UTC
I've tried validate() and repaint() to refresh JFrame after I change some values, so far not working.

What am I doing wrong?

i've tried:
validate()
repaint()
this.validate()
this.repaint()
frame.validate()
frame.repaint()

don't know, even changing the frame size by dragging doesn't refresh it, I've check the values and they're changed correctly.
Three answers:
wjb
2009-12-27 20:02:07 UTC
You need to call JFrame.invalidate() first, then call JFrame.validate().



See http://www.techtalkz.com/java/68602-jframe-help-please.html



Also http://java.sun.com/javase/6/docs/api/java/awt/Container.html#invalidate%28%29



"public void invalidate()

Invalidates the container. The container and all parents above it are marked as needing to be laid out. "



( Class JFrame inherits from class Container.

See http://java.sun.com/javase/6/docs/api/javax/swing/JFrame.html

the hierarchy is listed at the top of the page )
litzbarski
2016-09-28 11:01:42 UTC
Repaint Java
2016-03-14 05:33:35 UTC
Hello, i am real sorry but I have not played/done this ........ so I am unable tpo give you an answer at all....


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...