public class RSyntaxTextAreaUI extends RTextAreaUI
RSyntaxTextArea
. This allows us to implement
syntax highlighting.BasicTextUI.BasicCaret, BasicTextUI.BasicHighlighter
textArea
Constructor and Description |
---|
RSyntaxTextAreaUI(JComponent rSyntaxTextArea)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
View |
create(Element elem)
Creates the view for an element.
|
protected Highlighter |
createHighlighter()
Creates the highlighter to use for syntax text areas.
|
static ComponentUI |
createUI(JComponent ta) |
protected String |
getActionMapName()
Returns the name to use to cache/fetch the shared action map.
|
EditorKit |
getEditorKit(JTextComponent tc)
Fetches the EditorKit for the UI.
|
protected InputMap |
getRTextAreaInputMap()
Get the InputMap to use for the UI.
|
protected void |
paintBackground(Graphics g)
Paints the text area's background.
|
protected void |
paintMatchedBracket(Graphics g)
Paints the "matched bracket", if any.
|
protected void |
propertyChange(PropertyChangeEvent e)
Gets called whenever a bound property is changed on this UI's
RSyntaxTextArea . |
void |
refreshSyntaxHighlighting()
Updates the view.
|
int |
yForLineContaining(int offs)
Returns the y-coordinate of the line containing a specified offset.
|
createCaret, createKeymap, createRTextAreaActionMap, getRTextArea, getVisibleEditorRect, installDefaults, installKeyboardActions, installUI, paintCurrentLineHighlight, paintLineHighlights, paintMarginLine
getBaseline, getBaselineResizeBehavior, getMinimumSize, getPreferredSize, getPropertyPrefix
create, damageRange, damageRange, getComponent, getKeymapName, getMaximumSize, getNextVisualPositionFrom, getRootView, getToolTipText, installListeners, modelChanged, modelToView, modelToView, paint, paintSafely, setView, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUI, update, viewToModel, viewToModel
contains, getAccessibleChild, getAccessibleChildrenCount
public RSyntaxTextAreaUI(JComponent rSyntaxTextArea)
public static ComponentUI createUI(JComponent ta)
public View create(Element elem)
create
in interface ViewFactory
create
in class RTextAreaUI
elem
- The element.protected Highlighter createHighlighter()
createHighlighter
in class BasicTextUI
protected String getActionMapName()
getActionMapName
in class RTextAreaUI
public EditorKit getEditorKit(JTextComponent tc)
getEditorKit
in class RTextAreaUI
tc
- The text component for which this UI is installed.TextUI.getEditorKit(javax.swing.text.JTextComponent)
protected InputMap getRTextAreaInputMap()
This method is not named getInputMap()
because there is
a package-private method in BasicTextAreaUI
with that name.
Thus, creating a new method with that name causes certain compilers to
issue warnings that you are not actually overriding the original method
(since it is package-private).
getRTextAreaInputMap
in class RTextAreaUI
protected void paintBackground(Graphics g)
paintBackground
in class RTextAreaUI
g
- The graphics component on which to paint.protected void paintMatchedBracket(Graphics g)
g
- The graphics context.protected void propertyChange(PropertyChangeEvent e)
RSyntaxTextArea
.propertyChange
in class BasicTextAreaUI
e
- The property change event.public void refreshSyntaxHighlighting()
RSyntaxTextArea
changes its syntax editing style.public int yForLineContaining(int offs) throws BadLocationException
This is faster than calling modelToView(offs).y
, so it is
preferred if you do not need the actual bounding box.
yForLineContaining
in class RTextAreaUI
offs
- The offset info the document.-1
if
this text area doesn't yet have a positive size.BadLocationException
- If offs
isn't a valid offset
into the document.