javax.swing.text.Caret.removeChangeListener()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中javax.swing.text.Caret.removeChangeListener()方法的一些代码示例,展示了Caret.removeChangeListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Caret.removeChangeListener()方法的具体详情如下:
包路径:javax.swing.text.Caret
类名称:Caret
方法名:removeChangeListener

Caret.removeChangeListener介绍

暂无

代码示例

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

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);
    }
  }
}

代码示例来源:origin: net.java.abeille/abeille

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);
    }
  }
}

代码示例来源:origin: net.java.abeille/abeille

caret.removeChangeListener(caretL);
caret.removeChangeListener(caretL);

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

caret.removeChangeListener(caretL);
caret.removeChangeListener(caretL);

代码示例来源:origin: net.sf.squirrel-sql.plugins/syntax

public void sessionEnding()
  {
   ////////////////////////////////////////////
   // Better GCing
   getCaret().deinstall(this);
   if(getCaret() instanceof DefaultCaret)
   {
     ChangeListener[] changeListeners = ((DefaultCaret) getCaret()).getChangeListeners();

     for (ChangeListener changeListener : changeListeners)
     {
      getCaret().removeChangeListener(changeListener);
     }
   }
   //
   ////////////////////////////////////////////
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-mercurial

textComponent.removeComponentListener(this);
doc.removeDocumentListener(this);
caret.removeChangeListener(this);
if (caretTimer != null) {
  caretTimer.removeActionListener(this);

代码示例来源:origin: net.java.abeille/abeille

/**
 * 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();
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

/** 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();
  }
}

相关文章