I'm about to write a program that adds and removes tabs from a tabbed pane. But I'm not so sure of the mechanics behind the remove() method. The addTab() method requires a component. So far I've only used JPanels. If I use the remove() method and target a panel, will it just drop it from the TabbedPane but stay in memory or will it drop the panel along with everything in the panel? I'm not sure it matters, but what I usually do, for organization's sake, to create JPanels is I use a single method to construct the panel and then return it like this:
If that doesn't work how can I drop an object? I'm asking this because I don't want my application to eat anymore memory that it has to.