void (final Component component) { if (component instanceof JTextComponent) { ((JTextComponent)component).getDocument().removeDocumentListener(myDocumentListener); } else if (component instanceof EditorTextComponent) { ((EditorTextComponent)component).removeDocumentListener(myIdeaDocumentListener); } else if (component instanceof ItemSelectable) { ((ItemSelectable)component).removeItemListener(myItemListener); } else if (component instanceof JTree) { ((JTree)component).getModel().removeTreeModelListener(myTreeModelListener); } if (component instanceof JTable) { component.removePropertyChangeListener(myTableListener); TableModel model = ((JTable)component).getModel(); if (model != null) { model.removeTableModelListener(myTableModelListener); } component.removePropertyChangeListener(myCellEditorChangeListener); } if (component instanceof JSlider){ ((JSlider)component).removeChangeListener(myChangeListener); } UserActivityProviderComponent provider = getActivityProviderComponent(component); if (provider != null) { provider.removeChangeListener(myChangeListener); } }