Modifier and Type | Class and Description |
---|---|
public static class | StyledEditorKit.
An action to set paragraph alignment. |
pack-priv class | StyledEditorKit.
Tracks caret movement and keeps the input attributes set to reflect the current set of attribute definitions at the caret position. |
public static class | StyledEditorKit.
An action to toggle the bold attribute. |
public static class | StyledEditorKit.
An action to set the font family in the associated JEditorPane. |
public static class | StyledEditorKit.
An action to set the font size in the associated JEditorPane. |
public static class | StyledEditorKit.
An action to set foreground color. |
public static class | StyledEditorKit.
An action to toggle the italic attribute. |
pack-priv static class | StyledEditorKit.
StyledInsertBreakAction has similar behavior to that of
|
public abstract static class | StyledEditorKit.
An action that assumes it's being fired on a JEditorPane with a StyledEditorKit (or subclass) installed. |
pack-priv static class | |
public static class | StyledEditorKit.
An action to toggle the underline attribute. |
Modifier and Type | Field and Description |
---|---|
pack-priv Element | |
pack-priv Element | |
private static final Action[] | |
private static final ViewFactory | |
pack-priv MutableAttributeSet | inputAttributes
This is the set of attributes used to store the input attributes. |
private StyledEditorKit. | inputAttributeUpdater
This listener will be attached to the caret of the text component that the EditorKit gets installed into. |
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
public Object | Returns: the copyOverrides javax. |
public Document | Returns: the modelOverrides javax. |
private void | |
protected void | createInputAttributes(Element
the element element, MutableAttributeSet the attributes set)Copies the key/values in |
private void | |
public void | deinstall(JEditorPane
the JEditorPane c)Overrides javax. |
public Action[] | Returns: the command listOverrides javax. |
public Element | Returns: the elementFetches the element representing the current run of character attributes for the caret. |
public MutableAttributeSet | Returns: the attribute setOverrides javax. |
public ViewFactory | Returns: the factory |
public void | install(JEditorPane
the JEditorPane c)Overrides javax. |
currentParagraph | back to summary |
---|---|
pack-priv Element currentParagraph |
currentRun | back to summary |
---|---|
pack-priv Element currentRun |
defaultActions | back to summary |
---|---|
private static final Action[] defaultActions |
defaultFactory | back to summary |
---|---|
private static final ViewFactory defaultFactory |
inputAttributes | back to summary |
---|---|
pack-priv MutableAttributeSet inputAttributes This is the set of attributes used to store the input attributes. |
inputAttributeUpdater | back to summary |
---|---|
private StyledEditorKit. This listener will be attached to the caret of the text component that the EditorKit gets installed into. This should keep the input attributes updated for use by the styled actions. |
StyledEditorKit | back to summary |
---|---|
public StyledEditorKit() Creates a new EditorKit used for styled documents. |
clone | back to summary |
---|---|
public Object clone() Overrides javax. Creates a copy of the editor kit.
|
createDefaultDocument | back to summary |
---|---|
public Document createDefaultDocument() Overrides javax. Creates an uninitialized text storage model that is appropriate for this type of editor.
|
createInputAttributes | back to summary |
---|---|
private void createInputAttributes() Creates the AttributeSet used for the selection.
|
createInputAttributes | back to summary |
---|---|
protected void createInputAttributes(Element element, MutableAttributeSet set) Copies the key/values in This is called anytime the caret moves over a different location.
|
createInputAttributeUpdated | back to summary |
---|---|
private void createInputAttributeUpdated() Creates a new |
deinstall | back to summary |
---|---|
public void deinstall(JEditorPane c) Overrides javax. Called when the kit is being removed from the JEditorPane. This is used to unregister any listeners that were attached.
|
getActions | back to summary |
---|---|
public Action[] getActions() Overrides javax. Fetches the command list for the editor. This is the list of commands supported by the superclass augmented by the collection of commands defined locally for style operations.
|
getCharacterAttributeRun | back to summary |
---|---|
public Element getCharacterAttributeRun() Fetches the element representing the current run of character attributes for the caret.
|
getInputAttributes | back to summary |
---|---|
public MutableAttributeSet getInputAttributes() Overrides javax. Gets the input attributes for the pane. When the caret moves and there is no selection, the input attributes are automatically mutated to reflect the character attributes of the current caret location. The styled editing actions use the input attributes to carry out their actions.
|
getViewFactory | back to summary |
---|---|
public ViewFactory getViewFactory() Overrides javax. Fetches a factory that is suitable for producing views of any models that are produced by this kit. This is implemented to return View implementations for the following kinds of elements:
|
install | back to summary |
---|---|
public void install(JEditorPane c) Overrides javax. Called when the kit is being installed into a JEditorPane.
|
StyleConstants.Alignment
attribute for the
currently selected range of the target JEditorPane.
This is done by calling
StyledDocument.setParagraphAttributes
on the styled document associated with the target
JEditorPane.
If the target text component is specified as the
source of the ActionEvent and there is a command string,
the command string will be interpreted as an integer
that should be one of the legal values for the
StyleConstants.Alignment
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 JavaBeans
has been added to the java.beans
package.
Please see java.
.
Modifier and Type | Field and Description |
---|---|
private int |
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
public void | actionPerformed(ActionEvent
the action event e)Implements java. |
a | back to summary |
---|---|
private int a |
AlignmentAction | back to summary |
---|---|
public AlignmentAction(String nm, int a) Creates a new AlignmentAction.
|
actionPerformed | back to summary |
---|---|
public void actionPerformed(ActionEvent e) Implements java. Sets the alignment.
|
This implements PropertyChangeListener to update the input attributes when the Document changes, as if the Document changes the attributes will almost certainly change.
Access | Constructor and Description |
---|---|
pack-priv |
Modifier and Type | Method and Description |
---|---|
public void | caretUpdate(CaretEvent
the caret event e)Implements javax. |
public void | propertyChange(PropertyChangeEvent
A PropertyChangeEvent object describing the event source
and the property that has changed. evt)Implements java. |
pack-priv void |
AttributeTracker | back to summary |
---|---|
pack-priv AttributeTracker() |
caretUpdate | back to summary |
---|---|
public void caretUpdate(CaretEvent e) Implements javax. Doc from javax. Called when the caret position is updated.
|
propertyChange | back to summary |
---|---|
public void propertyChange(PropertyChangeEvent evt) Implements java. Doc from java. This method gets called when a bound property is changed.
|
updateInputAttributes | back to summary |
---|---|
pack-priv void updateInputAttributes(int dot, int mark, JTextComponent c) Updates the attributes. |
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 JavaBeans
has been added to the java.beans
package.
Please see java.
.
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
public void | actionPerformed(ActionEvent
the action event e)Implements java. |
BoldAction | back to summary |
---|---|
public BoldAction() Constructs a new BoldAction. |
actionPerformed | back to summary |
---|---|
public void actionPerformed(ActionEvent e) Implements java. Toggles the bold 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 JavaBeans
has been added to the java.beans
package.
Please see java.
.
Access | Constructor and Description |
---|---|
public | FontFamilyAction(String
the action name nm, String the font family family)Creates a new FontFamilyAction. |
Modifier and Type | Method and Description |
---|---|
public void | actionPerformed(ActionEvent
the event e)Implements java. |
family | back to summary |
---|---|
private String family |
FontFamilyAction | back to summary |
---|---|
public FontFamilyAction(String nm, String family) Creates a new FontFamilyAction. |
actionPerformed | back to summary |
---|---|
public void actionPerformed(ActionEvent e) Implements java. Sets the font family.
|
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 JavaBeans
has been added to the java.beans
package.
Please see java.
.
Modifier and Type | Field and Description |
---|---|
private int |
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
public void | actionPerformed(ActionEvent
the action event e)Implements java. |
size | back to summary |
---|---|
private int size |
FontSizeAction | back to summary |
---|---|
public FontSizeAction(String nm, int size) Creates a new FontSizeAction.
|
actionPerformed | back to summary |
---|---|
public void actionPerformed(ActionEvent e) Implements java. Sets the font size.
|
StyleConstants.Foreground
attribute for the
currently selected range of the target JEditorPane.
This is done by calling
StyledDocument.setCharacterAttributes
on the styled document associated with the target
JEditorPane.
If the target text component is specified as the
source of the ActionEvent and there is a command string,
the command string will be interpreted as the foreground
color. It will be interpreted by called
Color.decode
, and should therefore be
legal input for that method.
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 JavaBeans
has been added to the java.beans
package.
Please see java.
.
Access | Constructor and Description |
---|---|
public | ForegroundAction(String
the action name nm, Color the foreground color fg)Creates a new ForegroundAction. |
Modifier and Type | Method and Description |
---|---|
public void | actionPerformed(ActionEvent
the action event e)Implements java. |
fg | back to summary |
---|---|
private Color fg |
ForegroundAction | back to summary |
---|---|
public ForegroundAction(String nm, Color fg) Creates a new ForegroundAction. |
actionPerformed | back to summary |
---|---|
public void actionPerformed(ActionEvent e) Implements java. Sets the foreground color.
|
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 JavaBeans
has been added to the java.beans
package.
Please see java.
.
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
public void | actionPerformed(ActionEvent
the action event e)Implements java. |
ItalicAction | back to summary |
---|---|
public ItalicAction() Constructs a new ItalicAction. |
actionPerformed | back to summary |
---|---|
public void actionPerformed(ActionEvent e) Implements java. Toggles the italic attribute.
|
DefaultEditorKit.InsertBreakAction
. That is when
its actionPerformed
method is invoked, a newline
is inserted. Beyond that, this will reset the input attributes to
what they were before the newline was inserted.
Modifier and Type | Field and Description |
---|---|
private SimpleAttributeSet |
Access | Constructor and Description |
---|---|
pack-priv |
Modifier and Type | Method and Description |
---|---|
public void | actionPerformed(ActionEvent
the event to be processed e)Implements java. |
tempSet | back to summary |
---|---|
private SimpleAttributeSet tempSet |
StyledInsertBreakAction | back to summary |
---|---|
pack-priv StyledInsertBreakAction() |
actionPerformed | back to summary |
---|---|
public void actionPerformed(ActionEvent e) Implements java. Doc from java. Invoked when an action occurs.
|
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 JavaBeans
has been added to the java.beans
package.
Please see java.
.
Access | Constructor and Description |
---|---|
public | StyledTextAction(String
the name of the action nm)Creates a new StyledTextAction from a string action name. |
Modifier and Type | Method and Description |
---|---|
protected final JEditorPane | |
protected final StyledDocument | Returns: the documentthe editor e)Gets the document associated with an editor pane. |
protected final StyledEditorKit | Returns: the kitthe editor pane e)Gets the editor kit associated with an editor pane. |
protected final void | setCharacterAttributes(JEditorPane
the editor editor, AttributeSet the attributes attr, boolean if true, then replace the existing attributes first replace)Applies the given attributes to character content. |
protected final void | setParagraphAttributes(JEditorPane
the editor editor, AttributeSet the attributes attr, boolean if true, replace the existing attributes first replace)Applies the given attributes to paragraphs. |
StyledTextAction | back to summary |
---|---|
public StyledTextAction(String nm) Creates a new StyledTextAction from a string action name.
|
getEditor | back to summary |
---|---|
protected final JEditorPane getEditor(ActionEvent e) Gets the target editor for an action.
|
getStyledDocument | back to summary |
---|---|
protected final StyledDocument getStyledDocument(JEditorPane e) Gets the document associated with an editor pane.
|
getStyledEditorKit | back to summary |
---|---|
protected final StyledEditorKit getStyledEditorKit(JEditorPane e) Gets the editor kit associated with an editor pane.
|
setCharacterAttributes | back to summary |
---|---|
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.
|
setParagraphAttributes | back to summary |
---|---|
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.
|
Access | Constructor and Description |
---|---|
pack-priv |
Modifier and Type | Method and Description |
---|---|
public View | create(Element
the piece of the document to build a view of elem)Implements javax. |
StyledViewFactory | back to summary |
---|---|
pack-priv StyledViewFactory() |
create | back to summary |
---|---|
public View create(Element elem) Implements javax. Doc from javax. Creates a view from the given structural element of a document. |
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 JavaBeans
has been added to the java.beans
package.
Please see java.
.
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
public void | actionPerformed(ActionEvent
the action event e)Implements java. |
UnderlineAction | back to summary |
---|---|
public UnderlineAction() Constructs a new UnderlineAction. |
actionPerformed | back to summary |
---|---|
public void actionPerformed(ActionEvent e) Implements java. Toggles the Underline attribute.
|