e1009. Listing the Styles Associated with a JTextPane
This example lists the styles that have been associated with a text
pane.
DefaultStyledDocument doc = (DefaultStyledDocument)textPane.getDocument();
Enumeration enum = doc.getStyleNames();
while (enum.hasMoreElements()) {
String styleName = (String)enum.nextElement();
// Get style object
Style style = doc.getStyle(styleName);
}
e1006.
Highlighting Words in a JTextComponent
e1007.
Setting the Font and Color of Text in a JTextPane Using Styles
e1008.
Sharing Styles Between JTextPanes
e1010.
Listing the Attributes in a Style
e1011.
Using a Popup to Apply Styles to a JTextPane
e1012.
Retaining the Logical Style When Setting a New Paragraph Style
e1013.
Automatically Updating Styled Text When a Style Is Updated
e1014.
Determining If a Style Attribute Applies to a Character or the Paragraph
© 2002 Addison-Wesley.
|