void (final CustomPropertiesPanel propertiesPanel) { if (!Comparing.equal(propertiesPanel, myCustomPropertiesPanel)) { if (myCustomPropertiesPanel != null) { myCustomPropertiesPanel.removeChangeListener(myCustomPropertiesChangeListener); } myCustomPropertiesPanel = propertiesPanel; myCustomPropertiesPanel.addChangeListener(myCustomPropertiesChangeListener); myCustomPropertiesScrollPane.getViewport().setView(myCustomPropertiesPanel.getComponent()); } final CardLayout cardLayout = (CardLayout)getLayout(); cardLayout.show(this, CUSTOM_CARD); }