|
JavaTM 2 Platform Standard Edition |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.AbstractAction | +--javax.swing.text.TextAction | +--javax.swing.text.StyledEditorKit.StyledTextAction
An action that assumes it's being fired on a JEditorPane with a StyledEditorKit (or subclass) installed. This has some convenience methods for causing character or paragraph level attribute changes. The convenience methods will throw an IllegalArgumentException if the assumption of a StyledDocument, a JEditorPane, or a StyledEditorKit fail to be true.
The component that gets acted upon by the action will be the source of the ActionEvent if the source can be narrowed to a JEditorPane type. If the source can't be narrowed, the most recently focused text component is changed. If neither of these are the case, the action cannot be performed.
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. A future release of Swing will provide support for long term persistence.
Fields inherited from class javax.swing.AbstractAction |
changeSupport,
enabled |
Constructor Summary | |
StyledEditorKit.StyledTextAction(String nm)
Creates a new StyledTextAction from a string action name. |
Method Summary | |
protected JEditorPane |
getEditor(ActionEvent e)
Gets the target editor for an action. |
protected StyledDocument |
getStyledDocument(JEditorPane e)
Gets the document associated with an editor pane. |
protected StyledEditorKit |
getStyledEditorKit(JEditorPane e)
Gets the editor kit associated with an editor pane. |
protected void |
setCharacterAttributes(JEditorPane editor,
AttributeSet attr,
boolean replace)
Applies the given attributes to character content. |
protected void |
setParagraphAttributes(JEditorPane editor,
AttributeSet attr,
boolean replace)
Applies the given attributes to paragraphs. |
Methods inherited from class javax.swing.text.TextAction |
augmentList,
getFocusedComponent,
getTextComponent |
Methods inherited from class javax.swing.AbstractAction |
addPropertyChangeListener,
clone,
firePropertyChange,
getValue,
isEnabled,
putValue,
removePropertyChangeListener,
setEnabled |
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public StyledEditorKit.StyledTextAction(String nm)
nm
- the name of the actionMethod Detail |
protected final JEditorPane getEditor(ActionEvent e)
e
- the action eventprotected final StyledDocument getStyledDocument(JEditorPane e)
e
- the editorprotected final StyledEditorKit getStyledEditorKit(JEditorPane e)
e
- the editor paneprotected final void setCharacterAttributes(JEditorPane editor, AttributeSet attr, boolean replace)
editor
- the editorattr
- the attributesreplace
- if true, then replace the existing attributes firstprotected final void setParagraphAttributes(JEditorPane editor, AttributeSet attr, boolean replace)
editor
- the editorattr
- the attributesreplace
- if true, replace the existing attributes first
|
JavaTM 2 Platform Standard Edition |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |