public void actionPerformed(ActionEvent evt, JTextComponent target) { if (target != null) { EditorUI editorUI = Utilities.getEditorUI(target); Boolean overwriteMode = (Boolean)editorUI.getProperty(EditorUI.OVERWRITE_MODE_PROPERTY); // Now toggle overwriteMode = (overwriteMode == null || !overwriteMode.booleanValue()) ? Boolean.TRUE : Boolean.FALSE; editorUI.putProperty(EditorUI.OVERWRITE_MODE_PROPERTY, overwriteMode); } } }
public void actionPerformed(ActionEvent evt, JTextComponent target) { if (target != null) { EditorUI editorUI = Utilities.getEditorUI(target); Boolean overwriteMode = (Boolean) editorUI.getProperty(EditorUI.OVERWRITE_MODE_PROPERTY); // Now toggle overwriteMode = (overwriteMode == null || !overwriteMode.booleanValue()) ? Boolean.TRUE : Boolean.FALSE; editorUI.putProperty(EditorUI.OVERWRITE_MODE_PROPERTY, overwriteMode); } } }
/** 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(); } }
/** Called when the <tt>BaseTextUI</tt> is being installed * into the component. */ protected void installUI(JTextComponent c) { synchronized (getComponentLock()) { this.component = c; putProperty(COMPONENT_PROPERTY, c); // listen on component component.addPropertyChangeListener(this); component.addFocusListener(focusL); // listen on caret Caret caret = component.getCaret(); if (caret != null) { caret.addChangeListener(this); } BaseDocument doc = getDocument(); if (doc != null) { modelChanged(null, doc); } } // Make sure all the things depending on non-null component will be updated settingsChange(null); // fix for issue #16352 getDefaultColoring().apply(component); }
/** * Called when the <tt>BaseTextUI</tt> is being installed into the * component. */ protected void installUI(JTextComponent c) { synchronized (getComponentLock()) { this.component = c; putProperty(COMPONENT_PROPERTY, c); // listen on component component.addPropertyChangeListener(this); component.addFocusListener(focusL); // listen on caret Caret caret = component.getCaret(); if (caret != null) { caret.addChangeListener(this); } BaseDocument doc = getDocument(); if (doc != null) { modelChanged(null, doc); } } // Make sure all the things depending on non-null component will be // updated settingsChange(null); // fix for issue #16352 getDefaultColoring().apply(component); }