private void removeUnusedTabComponents() {
            for (int i = 0; i < getComponentCount(); i++) {
                Component c = getComponent(i);
                if (!(c instanceof UIResource)) {
                    int index = tabPane.indexOfTabComponent(c);
                    if (index == -1) {
                        PropertyChangeListener[] listeners = c.getPropertyChangeListeners();
                        for (int j = 0; j < listeners.length; j++) {
                            if (listeners[j] instanceof MyTabComponentListener) {
                                c.removePropertyChangeListener(listeners[j]);
                            }
                        }
                        super.remove(c);
                    }
                }
            }
        }