public void propertyChange(PropertyChangeEvent evt) { String propName = evt.getPropertyName(); if ("document".equals(propName)) { // NOI18N BaseDocument oldDoc = (evt.getOldValue() instanceof BaseDocument) ? (BaseDocument)evt.getOldValue() : null; BaseDocument newDoc = (evt.getNewValue() instanceof BaseDocument) ? (BaseDocument)evt.getNewValue() : null; modelChanged(oldDoc, newDoc); } else if ("margin".equals(propName)) { // NOI18N updateTextMargin(); } else if ("caret".equals(propName)) { // NOI18N if (evt.getOldValue() instanceof Caret) { ((Caret)evt.getOldValue()).removeChangeListener(this); } if (evt.getNewValue() instanceof Caret) { ((Caret)evt.getNewValue()).addChangeListener(this); } } else if ("enabled".equals(propName)) { // NOI18N if (!component.isEnabled()) { component.getCaret().setVisible(false); } } }
public void propertyChange(PropertyChangeEvent evt) { String propName = evt.getPropertyName(); if ("document".equals(propName)) { BaseDocument oldDoc = (evt.getOldValue() instanceof BaseDocument) ? (BaseDocument) evt.getOldValue() : null; BaseDocument newDoc = (evt.getNewValue() instanceof BaseDocument) ? (BaseDocument) evt.getNewValue() : null; modelChanged(oldDoc, newDoc); } else if ("margin".equals(propName)) { // NOI18N updateTextMargin(); } else if ("caret".equals(propName)) { // NOI18N if (evt.getOldValue() instanceof Caret) { ((Caret) evt.getOldValue()).removeChangeListener(this); } if (evt.getNewValue() instanceof Caret) { ((Caret) evt.getNewValue()).addChangeListener(this); } } else if ("enabled".equals(propName)) { // NOI18N if (!component.isEnabled()) { component.getCaret().setVisible(false); } } }
caret.removeChangeListener(caretL); caret.removeChangeListener(caretL);
caret.removeChangeListener(caretL); caret.removeChangeListener(caretL);
public void sessionEnding() { //////////////////////////////////////////// // Better GCing getCaret().deinstall(this); if(getCaret() instanceof DefaultCaret) { ChangeListener[] changeListeners = ((DefaultCaret) getCaret()).getChangeListeners(); for (ChangeListener changeListener : changeListeners) { getCaret().removeChangeListener(changeListener); } } // //////////////////////////////////////////// } }
textComponent.removeComponentListener(this); doc.removeDocumentListener(this); caret.removeChangeListener(this); if (caretTimer != null) { caretTimer.removeActionListener(this);
/** * Called when the <tt>BaseTextUI</tt> is being uninstalled from the * component. */ protected void uninstallUI(JTextComponent c) { synchronized (getComponentLock()) { // fix for issue 12996 if (component != null) { // stop listening on caret Caret caret = component.getCaret(); if (caret != null) { caret.removeChangeListener(this); } // stop listening on component component.removePropertyChangeListener(this); component.removeFocusListener(focusL); } BaseDocument doc = getDocument(); if (doc != null) { modelChanged(doc, null); } component = null; putProperty(COMPONENT_PROPERTY, null); // Clear the font-metrics cache FontMetricsCache.clear(); } }
/** Called when the <tt>BaseTextUI</tt> is being uninstalled * from the component. */ protected void uninstallUI(JTextComponent c) { synchronized (getComponentLock()) { // fix for issue 12996 if (component != null) { // stop listening on caret Caret caret = component.getCaret(); if (caret != null) { caret.removeChangeListener(this); } // stop listening on component component.removePropertyChangeListener(this); component.removeFocusListener(focusL); } BaseDocument doc = getDocument(); if (doc != null) { modelChanged(doc, null); } component = null; putProperty(COMPONENT_PROPERTY, null); // Clear the font-metrics cache FontMetricsCache.clear(); } }