|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.northwestern.at.utils.swing.styledtext.StyledString
public class StyledString
A styled string.
A styled string is a string plus style information. Styled strings are transferable objects with three flavors: plain text, styled text, and RTF.
Field Summary | |
---|---|
static java.awt.datatransfer.DataFlavor |
RTF_FLAVOR
Richtext format data flavor. |
java.lang.String |
str
The string. |
static java.awt.datatransfer.DataFlavor |
STYLED_STRING_FLAVOR
Styled string data flavor. |
StyleInfo |
styleInfo
The style information. |
Constructor Summary | |
---|---|
StyledString()
Constructs a new empty styled string. |
|
StyledString(java.lang.String str)
Constructs a new plain text styled string. |
|
StyledString(java.lang.StringBuffer strBuffer)
Constructs a new plain text styled string. |
|
StyledString(java.lang.String str,
StyleInfo styleInfo)
Constructs a new styled string. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Returns a copy of the styled string. |
boolean |
equals(java.lang.Object obj)
Compares this styled string to another styled string. |
java.lang.Object |
getTransferData(java.awt.datatransfer.DataFlavor flavor)
Gets the transfer data for a flavor. |
java.awt.datatransfer.DataFlavor[] |
getTransferDataFlavors()
Returns the supported data flavors. |
boolean |
isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
Returns true if a data flavor is supported. |
int |
length()
Returns the length of the string. |
java.lang.String |
toString()
Returns a plain string representation. |
void |
trim()
Trims leading and trailing whitespace. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.awt.datatransfer.DataFlavor STYLED_STRING_FLAVOR
public static final java.awt.datatransfer.DataFlavor RTF_FLAVOR
public java.lang.String str
public StyleInfo styleInfo
Constructor Detail |
---|
public StyledString()
public StyledString(java.lang.String str, StyleInfo styleInfo)
str
- The string.styleInfo
- The style information. public StyledString(java.lang.String str)
str
- The string. public StyledString(java.lang.StringBuffer strBuffer)
strBuffer
- The string. Method Detail |
---|
public void trim()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- The other styled string.
public int length()
public java.lang.String toString()
toString
in class java.lang.Object
public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
The supported data flavors are STYLED_STRING_FLAVOR (the full styled string), RTF_FLAVOR (the rich text format flavor), and DataFlavor.stringFlavor (the plain text string without the style information).
getTransferDataFlavors
in interface java.awt.datatransfer.Transferable
public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
isDataFlavorSupported
in interface java.awt.datatransfer.Transferable
flavor
- The data flavor.
public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor) throws java.awt.datatransfer.UnsupportedFlavorException, java.io.IOException
getTransferData
in interface java.awt.datatransfer.Transferable
flavor
- The data flavor.
java.awt.datatransfer.UnsupportedFlavorException
- The flavor is unsupported.
java.io.IOException
public java.lang.Object clone()
clone
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |