public class XMLContext extends StyleContext
Note: The XML Editor package is based on the JavaEditorKit example as described in the article 'Customizing a Text Editor' by Timothy Prinzing . See: http://java.sun.com/products/jfc/tsc/articles/text/editor_kit/
StyleContext.NamedStyle, StyleContext.SmallAttributeSetDEFAULT_STYLE| Constructor and Description |
|---|
XMLContext()
Constructs a set of style objects to represent XML lexical tokens and
initialises these tokens with a font style and color.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getFontStyle(Style style)
Fetch the font to use for a lexical token with the given scan value.
|
Color |
getForeground(String token)
Gets the foreground color to use for a lexical token with the given
value.
|
Color |
getForeground(Style style)
Return the foreground color.
|
Style |
getStyle(String token)
Return the style for the token.
|
void |
setFontStyle(String token,
int style)
Sets the font to use for a lexical token with the given value.
|
void |
setForeground(String token,
Color color)
Sets the foreground color to use for a lexical token with the given
value.
|
void |
setStyle(String token,
Color foreground,
int style)
Sets the styles, like foreground color and Font style.
|
addAttribute, addAttributes, addChangeListener, addStyle, createLargeAttributeSet, createSmallAttributeSet, getBackground, getChangeListeners, getCompressionThreshold, getDefaultStyleContext, getEmptySet, getFont, getFont, getFontMetrics, getForeground, getStaticAttribute, getStaticAttributeKey, getStyleNames, readAttributes, readAttributeSet, reclaim, registerStaticAttributeKey, removeAttribute, removeAttributes, removeAttributes, removeChangeListener, removeStyle, toString, writeAttributes, writeAttributeSetpublic XMLContext()
public void setStyle(String token, Color foreground, int style)
token - the token to set the font for.foreground - the foreground color for the token.style - the font-style value for the token.public void setFontStyle(String token, int style)
token - the token to set the font for.style - the font-style value for the token.public void setForeground(String token, Color color)
token - the token to set the foreground for.color - the foreground color value for the token.public Color getForeground(String token)
token - the style value for the token.public int getFontStyle(Style style)
style - the style.public Color getForeground(Style style)
style - the stylepublic Style getStyle(String token)
getStyle in class StyleContexttoken - the style identifier.Copyright © 2022 WSO2. All rights reserved.