-
refesh for SWING?
when i remove components from a SWING container i still see them, is there a refresh or repaint or update method i should call? i've checked the api but all the methods i found reuiqre a graphics paramether and for the life of my i wouulddn't know what to pass to it
-
Which method are you using? Just Curious :p
public void remove(int index);
public void remove(Component comp)
public void removeAll();
Two things you want to take into consideration with working in swing. 1.) You may need to call invalidate() if you make changes to the appearance of a displayed component. 2.) You must call validate() on Containers that have been invalidated(typically by the addition or invalidation of a child).
The invalidate() method is typically called on a Container to indicate that it's children need to be laid out, or on a Component to indicate that it needs to be re-rendered. Usually this method is called automatically but ive seen situations where this fails to take place (for instance when changing the size of a JButton by changing it's label or font.) In this case you must call invalidate() on the Component to mark it as invalid and validate() must be called on the Container().
-
:mad: i tried both remove (Component) and i tried removeAll()
as a thought you MUST be able to clone user(?) defined classes because all classes are fundamentally user-defined unless specifically in the JVM like arrays or something.