GNU Classpath (0.95) | |
Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
public class JTextPane
extends JEditorPane
StyledDocument
content model and a StyledEditorKit
.
Nested Class Summary |
Nested classes/interfaces inherited from class javax.swing.JEditorPane | |
JEditorPane.AccessibleJEditorPane , JEditorPane.AccessibleJEditorPaneHTML , JEditorPane.JEditorPaneAccessibleHypertextSupport |
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent | |
JTextComponent.AccessibleJTextComponent , JTextComponent.KeyBinding |
Nested classes/interfaces inherited from class javax.swing.JComponent | |
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container | |
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component | |
Component.AccessibleAWTComponent , Component.BltBufferStrategy , Component.FlipBufferStrategy |
Field Summary |
Fields inherited from class javax.swing.text.JTextComponent | |
DEFAULT_KEYMAP , FOCUS_ACCELERATOR_KEY |
Fields inherited from class javax.swing.JComponent | |
TOOL_TIP_TEXT_KEY , UNDEFINED_CONDITION , WHEN_ANCESTOR_OF_FOCUSED_COMPONENT , WHEN_FOCUSED , WHEN_IN_FOCUSED_WINDOW , accessibleContext , listenerList , ui |
Fields inherited from class java.awt.Component | |
BOTTOM_ALIGNMENT , CENTER_ALIGNMENT , LEFT_ALIGNMENT , RIGHT_ALIGNMENT , TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver | |
ABORT , ALLBITS , ERROR , FRAMEBITS , HEIGHT , PROPERTIES , SOMEBITS , WIDTH |
Constructor Summary | |
| |
|
Method Summary | |
Style | |
protected EditorKit |
|
AttributeSet |
|
MutableAttributeSet |
|
Style |
|
AttributeSet |
|
Style | |
StyledDocument |
|
protected StyledEditorKit |
|
String |
|
void |
|
void |
|
protected String |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public JTextPane(StyledDocument document)
Creates a newJTextPane
and sets the specifieddocument
.
- Parameters:
document
- the content model to use
public Style addStyle(String nm, Style parent)
Adds a style into the style hierarchy. Unspecified style attributes can be resolved in theparent
style, if one is specified. While it is legal to add nameless styles (nm == null
- Parameters:
nm
- the name of the style ornull
if the style should be unnamedparent
- the parent in which unspecified style attributes are resolved, ornull
if that is not necessary
- Returns:
- the newly created
Style
protected EditorKit createDefaultEditorKit()
- Overrides:
- createDefaultEditorKit in interface JEditorPane
- Returns:
- the default
EditorKit
that is used inJTextPane
s
public AttributeSet getCharacterAttributes()
Returns the text attributes for the character at the current caret position.
- Returns:
- the text attributes for the character at the current caret position
public MutableAttributeSet getInputAttributes()
Returns the attributes that are applied to newly inserted text. This is aMutableAttributeSet
, so you can easily modify these attributes.
- Returns:
- the attributes that are applied to newly inserted text
public Style getLogicalStyle()
Returns the logical style of the paragraph at the current caret position.
- Returns:
- the logical style of the paragraph at the current caret position
public AttributeSet getParagraphAttributes()
Returns the text attributes of the paragraph at the current caret position.
- Returns:
- the attributes of the paragraph at the current caret position
public Style getStyle(String nm)
Looks up and returns a namedStyle
.
- Parameters:
nm
- the name of theStyle
- Returns:
- the found
Style
ofnull
if no suchStyle
exists
public StyledDocument getStyledDocument()
Returns theStyledDocument
that is the content model for thisJTextPane
. This is a typed wrapper forgetDocument()
.
- Returns:
- the content model of this
JTextPane
protected final StyledEditorKit getStyledEditorKit()
Returns theStyledEditorKit
that is currently used by thisJTextPane
.
- Returns:
- the current
StyledEditorKit
of thisJTextPane
public String getUIClassID()
Returns the UI class ID. This isTextPaneUI
.
- Overrides:
- getUIClassID in interface JEditorPane
- Returns:
TextPaneUI
public void insertComponent(Component component)
Inserts an AWT or Swing component into the text at the current caret position.
- Parameters:
component
- the component to be inserted
public void insertIcon(Icon icon)
Inserts anIcon
into the text at the current caret position.
- Parameters:
icon
- theIcon
to be inserted
protected String paramString()
Returns a param string that can be used for debugging.
- Overrides:
- paramString in interface JEditorPane
- Returns:
- a param string that can be used for debugging.
public void removeStyle(String nm)
Removes a namedStyle
from the style hierarchy.
- Parameters:
nm
- the name of theStyle
to be removed
public void replaceSelection(String content)
Replaces the currently selected text with the specifiedcontent
. If there is no selected text, this results in a simple insertion at the current caret position. If there is nocontent
specified, this results in the selection beeing deleted.
- Overrides:
- replaceSelection in interface JEditorPane
- Parameters:
content
- the text with which the selection is replaced
public void setCharacterAttributes(AttributeSet attribute, boolean replace)
Sets text attributes for the current selection. If there is no selection the text attributes are applied to newly inserted text
- Parameters:
attribute
- the text attributes to setreplace
- iftrue
, the attributes of the current selection are overridden, otherwise they are merged
- See Also:
getInputAttributes()
public void setDocument(Document document)
Sets the content model for thisJTextPane
.JTextPane
can only be used withStyledDocument
s, if you try to set a different type ofDocument
, anIllegalArgumentException
is thrown.
- Overrides:
- setDocument in interface JTextComponent
- Parameters:
document
- the content model to set
- Throws:
IllegalArgumentException
- ifdocument
is not an instance ofStyledDocument
- See Also:
setStyledDocument(StyledDocument)
public final void setEditorKit(EditorKit editor)
Sets theEditorKit
to use for thisJTextPane
.JTextPane
s can only handleStyledEditorKit
s, if client programs try to set a different type ofEditorKit
then an IllegalArgumentException is thrown
- Overrides:
- setEditorKit in interface JEditorPane
- Parameters:
editor
- theEditorKit
to set
- Throws:
IllegalArgumentException
- ifeditor
is noStyledEditorKit
public void setLogicalStyle(Style style)
Sets the logical style for the paragraph at the current caret position.
- Parameters:
style
- the style to set for the current paragraph
public void setParagraphAttributes(AttributeSet attribute, boolean replace)
Sets text attributes for the paragraph at the current selection. If there is no selection the text attributes are applied to the paragraph at the current caret position.
- Parameters:
attribute
- the text attributes to setreplace
- iftrue
, the attributes of the current selection are overridden, otherwise they are merged
public void setStyledDocument(StyledDocument document)
Sets the content model for thisJTextPane
.
- Parameters:
document
- the content model to set
GNU Classpath (0.95) |