This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes Refresh a window after ActionEvent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Refresh a window after ActionEvent" Watch "Refresh a window after ActionEvent" New topic
Author

Refresh a window after ActionEvent

Jesse Walker
Ranch Hand

Joined: Aug 18, 2004
Posts: 50
I would like the window to add a component after someone presses a button, how do I go about doing that? is the pain/repaint() method the best approach?
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
You can use the validate() method.

This is from the API for Container.

validate

public void validate()

Validates this container and all of its subcomponents.

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.

Overrides:
validate in class Component

Jesse Walker
Ranch Hand

Joined: Aug 18, 2004
Posts: 50
I will try that I have been trying to use the repaint() but have been getting weird layouts, even using a layout manager.
thanks,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Refresh a window after ActionEvent