• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Refresh a window after ActionEvent

 
Jesse Walker
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will try that I have been trying to use the repaint() but have been getting weird layouts, even using a layout manager.
thanks,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic