Is this your first time here? SwingWiki is a Java Swing Developer community site with an big archive of Swing-related usenet groups and mailing lists, but also tips, tricks and articles and book reviews written by your colleagues from around the world. If you came here through a search engine and did not find what you were looking for, make sure to check the wiki table of contents.

Use RemoveNotify event for cleaning

Since Java does not support destructors, you cannot automatically release resources held by a screen component when it’s life cycle ends. This may be a big problem, since many GUI components are typically linked with large memory resources (background screen images, image collections, file contents etc.), and some even hold non-memory resources (DB connections, for example). If you are creating components for one-time use (not to be shown on the screen again after being removed, and not to be moved between containers), you can use the removeNotify() method for cleaning operations. Just remember to call super.removeNotify() first.

See Animated Label for an example.


Comments? Corrections? Contact us or Login to edit pages directly (registration is free and takes less than displaying a JLabel)
  best/use_removenotify_for_cleaning.txt · Last modified: 2005/02/13 20:16 by (gojko)
Recent changes | RSS changes | Table of contents | News Archive | Terms And Conditions | Register | The Quest For Software++| Ruby Resources

Sedo - Buy and Sell Domain Names and Websites project info: Statistics for project etracker� web controlling instead of log file analysis