本文整理了Java中javax.swing.text.JTextComponent.removeCaretListener()
方法的一些代码示例,展示了JTextComponent.removeCaretListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextComponent.removeCaretListener()
方法的具体详情如下:
包路径:javax.swing.text.JTextComponent
类名称:JTextComponent
方法名:removeCaretListener
暂无
代码示例来源:origin: de.sciss/syntaxpane
@Override
protected void finalize() throws Throwable {
text.removeCaretListener(this);
super.finalize();
}
代码示例来源:origin: de.sciss/jsyntaxpane
@Override
protected void finalize() throws Throwable {
text.removeCaretListener(this);
super.finalize();
}
代码示例来源:origin: de.sciss/jsyntaxpane
@Override
public void deinstall(JEditorPane editor) {
status = Status.DEINSTALLING;
pane.removeCaretListener(this);
removeMarkers();
}
代码示例来源:origin: de.sciss/syntaxpane
@Override
public void deinstall(JEditorPane editor) {
status = Status.DEINSTALLING;
pane.removeCaretListener(this);
removeMarkers();
}
代码示例来源:origin: com.fifesoft/autocomplete
public void removeFrom(JTextComponent tc) {
tc.removeFocusListener(this);
tc.getDocument().removeDocumentListener(this);
tc.removeCaretListener(this);
timer.stop();
justInserted = false;
}
代码示例来源:origin: de.sciss/syntaxpane
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals("document")) {
pane.removeCaretListener(this);
if (status.equals(Status.INSTALLING)) {
pane.addCaretListener(this);
removeMarkers();
}
}
}
}
代码示例来源:origin: de.sciss/jsyntaxpane
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals("document")) {
pane.removeCaretListener(this);
if (status.equals(Status.INSTALLING)) {
pane.addCaretListener(this);
removeMarkers();
}
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-gsf
public void editorRegistryChanged() {
final JTextComponent editor = EditorRegistry.lastFocusedComponent();
final JTextComponent lastEditor = lastEditorRef == null ? null : lastEditorRef.get();
if (lastEditor != editor) {
if (lastEditor != null) {
lastEditor.removeCaretListener(this);
//lastEditor.removePropertyChangeListener(this);
final Document doc = lastEditor.getDocument();
Source js = null;
if (doc != null) {
js = forDocument(doc);
}
//if (js != null) {
// js.k24 = false;
//}
}
lastEditorRef = new WeakReference<JTextComponent>(editor);
if (editor != null) {
editor.addCaretListener(this);
//lastEditor.addPropertyChangeListener(this);
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-gsf
public void stateChanged(ChangeEvent e) {
List<JTextComponent> added = new ArrayList<JTextComponent>(OpenedEditors.getDefault().getVisibleEditors());
List<JTextComponent> removed = new ArrayList<JTextComponent>(component2Listener.keySet());
added.removeAll(component2Listener.keySet());
removed.removeAll(OpenedEditors.getDefault().getVisibleEditors());
for (JTextComponent c : removed) {
c.removeCaretListener(component2Listener.remove(c));
}
for (JTextComponent c : added) {
ComponentListener l = new ComponentListener(c);
c.addCaretListener(l);
component2Listener.put(c, l);
//TODO: are we in AWT Thread?:
setLastPosition(OpenedEditors.getFileObject(c), c.getCaretPosition());
}
fileObjectsChanged();
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-gsf
public void stateChanged(ChangeEvent e) {
List<JTextComponent> added = new ArrayList<JTextComponent>(OpenedEditors.getDefault().getVisibleEditors());
List<JTextComponent> removed = new ArrayList<JTextComponent>(component2Listener.keySet());
added.removeAll(component2Listener.keySet());
removed.removeAll(OpenedEditors.getDefault().getVisibleEditors());
for (JTextComponent c : removed) {
c.removeCaretListener(component2Listener.remove(c));
}
for (JTextComponent c : added) {
ComponentListener l = new ComponentListener(c);
c.addCaretListener(l);
component2Listener.put(c, l);
//TODO: are we in AWT Thread?:
setLastSelection(OpenedEditors.getFileObject(c), c.getSelectionStart(), c.getSelectionEnd());
}
fileObjectsChanged();
}
代码示例来源:origin: com.fifesoft/autocomplete
/**
* Uninstalls this listener from the current text component.
*/
public void uninstall() {
JTextComponent tc = ac.getTextComponent();
tc.removeCaretListener(this);
tc.removeFocusListener(this);
tc.getDocument().removeDocumentListener(this);
uninstallKeyBindings();
if (markOccurrencesEnabled) {
((RSyntaxTextArea)tc).setMarkOccurrences(markOccurrencesEnabled);
}
// Remove WeakReferences in javax.swing.text.
maxPos = null;
minPos = -1;
removeParameterHighlights();
}
代码示例来源:origin: net.java.abeille/abeille
component.removeCaretListener(caretL);
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib
component.removeCaretListener( caretL );
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-editor-deprecated-pre61completion
component.removeCaretListener( caretL );
代码示例来源:origin: robo-code/robocode
/**
* Uninstalls CurrentLineHighligher for the given JTextComponent.
* @param c is the text component
*/
public static void uninstall(JTextComponent c) {
c.putClientProperty(LINE_HIGHLIGHT, null);
c.putClientProperty(PREVIOUS_CARET, null);
c.removeCaretListener(caretListener);
c.removeMouseListener(mouseListener);
c.removeMouseMotionListener(mouseMotionListener);
EditorThemePropertiesManager.removeListener(editorThemePropertyChangeListener);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-parsing-nb
private void editorRegistryChanged() {
final JTextComponent editor = EditorRegistry.lastFocusedComponent();
final JTextComponent lastEditor = lastEditorRef == null ? null : lastEditorRef.get();
if (lastEditor != editor && (editor == null || editor.getClientProperty("AsTextField") == null)) {
if (lastEditor != null) {
lastEditor.removeCaretListener(this);
lastEditor.removePropertyChangeListener(this);
k24.set(false);
}
lastEditorRef = new WeakReference<JTextComponent>(editor);
if (editor != null) {
editor.addCaretListener(this);
editor.addPropertyChangeListener(this);
}
final JTextComponent focused = EditorRegistry.focusedComponent();
if (focused != null) {
final Document doc = editor.getDocument();
final String mimeType = DocumentUtilities.getMimeType (doc);
if (doc != null && mimeType != null) {
final Source source = Source.create (doc);
if (source != null) {
((EventSupport)SourceEnvironment.forSource(source)).resetState(true, false, -1, -1, true);
}
}
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-parsing-nb
protected void setEditor (JTextComponent editor) {
if (currentEditor != null)
currentEditor.removeCaretListener (caretListener);
currentEditor = editor;
if (editor != null) {
if (caretListener == null)
caretListener = new ACaretListener ();
editor.addCaretListener (caretListener);
Document document = editor.getDocument ();
if (currentDocument == document) return;
currentDocument = document;
final Source source = Source.create (currentDocument);
schedule (source, new CursorMovedSchedulerEvent (this, editor.getCaret ().getDot (), editor.getCaret ().getMark ()) {});
}
else {
currentDocument = null;
schedule(null, null);
}
}
代码示例来源:origin: com.fifesoft/autocomplete
comp.removeCaretListener(this);
代码示例来源:origin: net.java.dev.appframework/appframework
void updateFocusOwner(JComponent oldOwner, JComponent newOwner) {
if (oldOwner instanceof JTextComponent) {
JTextComponent text = (JTextComponent)oldOwner;
text.removeCaretListener(textComponentCaretListener);
text.removePropertyChangeListener(textComponentPCL);
}
if (newOwner instanceof JTextComponent) {
JTextComponent text = (JTextComponent)newOwner;
maybeInstallTextActions(text);
updateTextActions(text);
text.addCaretListener(textComponentCaretListener);
text.addPropertyChangeListener(textComponentPCL);
}
else if (newOwner == null) {
setCopyEnabled(false);
setCutEnabled(false);
setPasteEnabled(false);
setDeleteEnabled(false);
}
}
代码示例来源:origin: org.jdesktop.bsaf/bsaf
void updateFocusOwner(JComponent oldOwner, JComponent newOwner) {
if (oldOwner instanceof JTextComponent) {
JTextComponent text = (JTextComponent) oldOwner;
text.removeCaretListener(textComponentCaretListener);
text.removePropertyChangeListener(textComponentPCL);
}
if (newOwner instanceof JTextComponent) {
JTextComponent text = (JTextComponent) newOwner;
maybeInstallTextActions(text);
updateTextActions(text);
text.addCaretListener(textComponentCaretListener);
text.addPropertyChangeListener(textComponentPCL);
} else if (newOwner == null) {
setCopyEnabled(false);
setCutEnabled(false);
setPasteEnabled(false);
setDeleteEnabled(false);
setSelectAllEnabled(false);
}
}
内容来源于网络,如有侵权,请联系作者删除!