All Packages Class Hierarchy This Package Previous Next Index
Interface com.sun.java.swing.text.StyledDocument
- public interface StyledDocument
- extends Document
-
addStyle(String, Style)
- Add a new style into the logical style hierarchy.
-
getBackground(AttributeSet)
- Take a set of attributes and turn it into a color
specification.
-
getCharacterElement(int)
- Gets the element that represents the character that
is at the given offset within the document.
-
getFont(AttributeSet)
- Take a set of attributes and turn it into a font
specification.
-
getForeground(AttributeSet)
- Take a set of attributes and turn it into a color
specification.
-
getLogicalStyle(int)
-
-
getParagraphElement(int)
- Gets the element that represents the paragraph that
encloses the given offset within the document.
-
getStyle(String)
- Fetch a named style previously added.
-
insert(int, ElementSpec[])
- Insert a bunch of data into the document in batch.
-
removeStyle(String)
- Remove a named style previously added to the document.
-
setCharacterAttributes(int, int, AttributeSet, boolean)
- Changes the content element attributes used for the given range of
existing content in the document.
-
setLogicalStyle(int, Style)
-
-
setParagraphAttributes(int, int, AttributeSet, boolean)
-
insert
public abstract void insert(int offset,
ElementSpec data[]) throws BadLocationException
- Insert a bunch of data into the document in batch.
This would generally be used by a reader implementation
that reads and file, clipboard, etc and places the
resulting data into the document. The data can include
markup which may be used to form element structure.
addStyle
public abstract Style addStyle(String nm,
Style parent)
- Add a new style into the logical style hierarchy. Style attributes
resolve from bottom up so an attribute specified in a child
will override an attribute specified in the parent.
- Parameters:
- nm - The name of the style (must be unique within the
collection of named styles). The name may be null if the style
is unnamed, but the caller is responsible
for managing the reference returned as an unnamed style can't
be fetched by name. An unnamed style may be useful for things
like character attribute overrides such as found in a style
run.
- parent - The parent style. This may be null if unspecified
attributes need not be resolved in some other style.
removeStyle
public abstract void removeStyle(String nm)
- Remove a named style previously added to the document.
- Parameters:
- nm - The name of the style to remove
getStyle
public abstract Style getStyle(String nm)
- Fetch a named style previously added.
- Parameters:
- nm - The name of the style
setCharacterAttributes
public abstract void setCharacterAttributes(int offset,
int length,
AttributeSet s,
boolean replace)
- Changes the content element attributes used for the given range of
existing content in the document. All of the attributes
defined in the given Attributes argument are applied to the
given range. This method can be used to completely remove
all content level attributes for the given range by
giving an Attributes argument that has no attributes defined
and setting replace to true.
- Parameters:
- offset - the start of the change
- length - the length of the change
- s - the attributes to change to. Any attributes
defined will be applied to the text for the given range.
- replace - indicates whether or not the previous
attributes should be cleared before the new attributes
as set. If true, the operation will replace the
previous attributes entirely. If false, the new
attributes will be merged with the previous attributes.
setParagraphAttributes
public abstract void setParagraphAttributes(int offset,
int length,
AttributeSet s,
boolean replace)
setLogicalStyle
public abstract void setLogicalStyle(int pos,
Style s)
getLogicalStyle
public abstract Style getLogicalStyle(int p)
getParagraphElement
public abstract Element getParagraphElement(int pos)
- Gets the element that represents the paragraph that
encloses the given offset within the document.
- Parameters:
- pos - the offset
- Returns:
- the element
getCharacterElement
public abstract Element getCharacterElement(int pos)
- Gets the element that represents the character that
is at the given offset within the document.
- Parameters:
- pos - the offset
- Returns:
- the element
getForeground
public abstract Color getForeground(AttributeSet attr)
- Take a set of attributes and turn it into a color
specification. This might be used to specify things
like brighter, more hue, etc.
getBackground
public abstract Color getBackground(AttributeSet attr)
- Take a set of attributes and turn it into a color
specification. This might be used to specify things
like brighter, more hue, etc.
getFont
public abstract Font getFont(AttributeSet attr)
- Take a set of attributes and turn it into a font
specification. This can be used to turn things like
family, style, size, etc into a font that is available
on the system the document is currently being used on.
All Packages Class Hierarchy This Package Previous Next Index