public class RTextAreaUI
extends javax.swing.plaf.basic.BasicTextAreaUI
RTextArea. This UI takes into
account all of the "extras" involved in an RTextArea, including
having a special caret (for insert and overwrite), background images,
highlighting the current line, etc.| 构造器和说明 |
|---|
RTextAreaUI(javax.swing.JComponent textArea)
Constructor.
|
| 限定符和类型 | 方法和说明 |
|---|---|
javax.swing.text.View |
create(javax.swing.text.Element elem)
Creates the view for an element.
|
protected javax.swing.text.Caret |
createCaret()
Returns the default caret for an
RTextArea. |
protected javax.swing.text.Keymap |
createKeymap()
Creates the keymap for this text area.
|
protected javax.swing.ActionMap |
createRTextAreaActionMap()
Creates a default action map.
|
static javax.swing.plaf.ComponentUI |
createUI(javax.swing.JComponent textArea)
Creates a UI for an RTextArea.
|
protected java.lang.String |
getActionMapName()
Returns the name to use to cache/fetch the shared action map.
|
javax.swing.text.EditorKit |
getEditorKit(javax.swing.text.JTextComponent tc)
Fetches the EditorKit for the UI.
|
RTextArea |
getRTextArea()
Returns the text area for which we are the UI.
|
protected javax.swing.InputMap |
getRTextAreaInputMap()
Get the InputMap to use for the UI.
|
protected java.awt.Rectangle |
getVisibleEditorRect()
Gets the allocation to give the root View.
|
protected void |
installDefaults() |
protected void |
installKeyboardActions() |
void |
installUI(javax.swing.JComponent c)
Installs this UI to the given text component.
|
protected void |
paintBackground(java.awt.Graphics g) |
protected void |
paintCurrentLineHighlight(java.awt.Graphics g,
java.awt.Rectangle visibleRect)
Paints the highlighted current line, if it is enabled.
|
protected void |
paintLineHighlights(java.awt.Graphics g)
Paints any line highlights.
|
protected void |
paintMarginLine(java.awt.Graphics g,
java.awt.Rectangle visibleRect)
Draws the "margin line" if enabled.
|
int |
yForLine(int line)
Returns the y-coordinate of the specified line.
|
int |
yForLineContaining(int offs)
Returns the y-coordinate of the line containing an offset.
|
getBaseline, getBaselineResizeBehavior, getMinimumSize, getPreferredSize, getPropertyPrefix, propertyChangecreate, createHighlighter, damageRange, damageRange, getComponent, getKeymapName, getMaximumSize, getNextVisualPositionFrom, getRootView, getToolTipText, installListeners, modelChanged, modelToView, modelToView, paint, paintSafely, setView, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUI, update, viewToModel, viewToModelprotected RTextArea textArea
public RTextAreaUI(javax.swing.JComponent textArea)
textArea - An instance of RTextArea.java.lang.IllegalArgumentException - If textArea is not an
instance of RTextArea.public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent textArea)
textArea - A text area.public javax.swing.text.View create(javax.swing.text.Element elem)
create 在接口中 javax.swing.text.ViewFactorycreate 在类中 javax.swing.plaf.basic.BasicTextAreaUIelem - The element.protected javax.swing.text.Caret createCaret()
RTextArea. This caret is
capable of displaying itself differently for insert/overwrite modes.createCaret 在类中 javax.swing.plaf.basic.BasicTextUIprotected javax.swing.text.Keymap createKeymap()
createKeymap 在类中 javax.swing.plaf.basic.BasicTextUIprotected javax.swing.ActionMap createRTextAreaActionMap()
This isn't named createActionMap() because there is a
package-private member by that name in BasicTextAreaUI,
and some compilers will give warnings that we are not overriding that
method since it is package-private.
protected java.lang.String getActionMapName()
public javax.swing.text.EditorKit getEditorKit(javax.swing.text.JTextComponent tc)
getEditorKit 在类中 javax.swing.plaf.basic.BasicTextUItc - the text component for which this UI is installedTextUI.getEditorKit(javax.swing.text.JTextComponent)public RTextArea getRTextArea()
protected javax.swing.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).
protected java.awt.Rectangle getVisibleEditorRect()
getVisibleEditorRect 在类中 javax.swing.plaf.basic.BasicTextUIprotected void installDefaults()
installDefaults 在类中 javax.swing.plaf.basic.BasicTextAreaUIprotected void installKeyboardActions()
installKeyboardActions 在类中 javax.swing.plaf.basic.BasicTextUIpublic void installUI(javax.swing.JComponent c)
installUI 在类中 javax.swing.plaf.basic.BasicTextUIprotected void paintBackground(java.awt.Graphics g)
paintBackground 在类中 javax.swing.plaf.basic.BasicTextUIprotected void paintCurrentLineHighlight(java.awt.Graphics g,
java.awt.Rectangle visibleRect)
g - The graphics context with which to paint.visibleRect - The visible rectangle of the text area.protected void paintLineHighlights(java.awt.Graphics g)
g - The graphics context.protected void paintMarginLine(java.awt.Graphics g,
java.awt.Rectangle visibleRect)
g - The graphics context to paint with.visibleRect - The visible rectangle of this text area.public int yForLine(int line)
throws javax.swing.text.BadLocationException
The default implementation is equivalent to:
int startOffs = textArea.getLineStartOffset(line); return yForLineContaining(startOffs);Subclasses that can calculate this value more quickly than traditional
BasicTextUI.modelToView(JTextComponent, int) calls should override this
method to do so. This method may be used when the entire bounding box
isn't needed, to speed up rendering.line - The line number.-1 if
this text area doesn't yet have a positive size or the line is
hidden (i.e. from folding).javax.swing.text.BadLocationException - If line isn't a valid line
number for this document.public int yForLineContaining(int offs)
throws javax.swing.text.BadLocationException
The default implementation is equivalent to:
int line = textArea.getLineOfOffset(offs); int startOffs = textArea.getLineStartOffset(line); return modelToView(startOffs).y;Subclasses that can calculate this value more quickly than traditional
BasicTextUI.modelToView(JTextComponent, int) calls should override this
method to do so. This method may be used when the entire bounding box
isn't needed, to speed up rendering.offs - The offset info the document.-1 if
this text area doesn't yet have a positive size or the line is
hidden (i.e. from folding).javax.swing.text.BadLocationException - If offs isn't a valid offset
into the document.