javax.swing.text
public static class: StyledEditorKit.ItalicAction [javadoc |
source]
java.lang.Object
javax.swing.AbstractAction
javax.swing.text.TextAction
javax.swing.text.StyledEditorKit$StyledTextAction
javax.swing.text.StyledEditorKit$ItalicAction
All Implemented Interfaces:
Action, Cloneable, Serializable
An action to toggle the italic attribute.
Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeansTM
has been added to the java.beans package.
Please see java.beans.XMLEncoder .
| Method from javax.swing.text.StyledEditorKit$ItalicAction Summary: |
|---|
|
actionPerformed |
| Methods from javax.swing.AbstractAction: |
|---|
|
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, hasSelectedKey, isEnabled, isSelected, putValue, removePropertyChangeListener, setEnabled, setEnabledFromAction, setToolTipTextFromAction, shouldReconfigure |
| Methods from java.lang.Object: |
|---|
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from javax.swing.text.StyledEditorKit$ItalicAction Detail: |
public void actionPerformed(ActionEvent e) {
JEditorPane editor = getEditor(e);
if (editor != null) {
StyledEditorKit kit = getStyledEditorKit(editor);
MutableAttributeSet attr = kit.getInputAttributes();
boolean italic = (StyleConstants.isItalic(attr)) ? false : true;
SimpleAttributeSet sas = new SimpleAttributeSet();
StyleConstants.setItalic(sas, italic);
setCharacterAttributes(editor, sas, false);
}
}
Toggles the italic attribute. |