Reputation: 94
i have shifted my programming from C# to Java for only one project as my teacher told me to do so. I just wanted to ask what is an equivalent of:
this.Refresh();
in Java?
Upvotes: 1
Views: 157
Reputation: 1253
yourFrame.invalidate();
//make changes here...
yourFrame.validate();
yourFrame.repaint();
See JFrame documentation for more things you think you will need.
Upvotes: 0
Reputation: 10280
Call
yourFrame.invalidate();
yourframe.validate();
See more information about invalidate()
and validate()
here.
Per the documentation: The validate method is used to cause a container to lay out its subcomponents again. It should be invoked when this container's subcomponents are modified (added to or removed from the container, or layout-related information changed) after the container has been displayed.
Upvotes: 0
Reputation: 10062
You assume that a Java application is automagically equivalent to Windows Forms which gives you a form you can Refresh to "repaint". In Java things are more complicated and you should probably read this first: How to Create a Simple Java GUI
Upvotes: 1