This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.swing.text
class StyledEditorKit.StyledTextAction

java.lang.Object extended by javax.swing.AbstractAction extended by javax.swing.text.TextAction extended by javax.swing.text.StyledEditorKit.StyledTextAction
All Implemented Interfaces:
Serializable, Cloneable, Action
Direct Known Subclasses:
HTMLEditorKit.HTMLTextAction, StyledEditorKit.AlignmentAction, StyledEditorKit.BoldAction, StyledEditorKit.FontFamilyAction, StyledEditorKit.FontSizeAction, StyledEditorKit.ForegroundAction, StyledEditorKit.ItalicAction, StyledEditorKit.UnderlineAction
Enclosing class:
StyledEditorKit

public abstract static class StyledEditorKit.StyledTextAction
extends TextAction

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. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see {@link java.beans.XMLEncoder}.


Field Summary
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Constructor Summary

          Creates a new StyledTextAction from a string action name.
 
Method Summary
protected JEditorPane

          Gets the target editor for an action.
protected StyledDocument

          Gets the document associated with an editor pane.
protected StyledEditorKit

          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, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StyledEditorKit.StyledTextAction

public StyledEditorKit.StyledTextAction(String nm)
Creates a new StyledTextAction from a string action name.

Parameters:
nm - the name of the action
Method Detail

getEditor

protected final JEditorPane getEditor(ActionEvent e)
Gets the target editor for an action.

Parameters:
e - the action event
Returns:
the editor

getStyledDocument

protected final StyledDocument getStyledDocument(JEditorPane e)
Gets the document associated with an editor pane.

Parameters:
e - the editor
Returns:
the document

getStyledEditorKit

protected final StyledEditorKit getStyledEditorKit(JEditorPane e)
Gets the editor kit associated with an editor pane.

Parameters:
e - the editor pane
Returns:
the kit

setCharacterAttributes

protected final void setCharacterAttributes(JEditorPane editor,
                                            AttributeSet attr,
                                            boolean replace)
Applies the given attributes to character content. If there is a selection, the attributes are applied to the selection range. If there is no selection, the attributes are applied to the input attribute set which defines the attributes for any new text that gets inserted.

Parameters:
editor - the editor
attr - the attributes
replace - if true, then replace the existing attributes first

setParagraphAttributes

protected final void setParagraphAttributes(JEditorPane editor,
                                            AttributeSet attr,
                                            boolean replace)
Applies the given attributes to paragraphs. If there is a selection, the attributes are applied to the paragraphs that intersect the selection. if there is no selection, the attributes are applied to the paragraph at the current caret position.

Parameters:
editor - the editor
attr - the attributes
replace - if true, replace the existing attributes first


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.