javax.swing.plaf.basic
public abstract class BasicTextUI extends TextUI implements ViewFactory
Nested Class Summary | |
---|---|
static class | BasicTextUI.BasicCaret
A {@link DefaultCaret} that implements {@link UIResource}. |
static class | BasicTextUI.BasicHighlighter
A {@link DefaultHighlighter} that implements {@link UIResource}. |
Constructor Summary | |
---|---|
BasicTextUI()
Creates a new BasicTextUI instance. |
Method Summary | |
---|---|
View | create(Element elem)
Creates a {@link View} for the specified {@link Element}.
|
View | create(Element elem, int p0, int p1)
Creates a {@link View} for the specified {@link Element}.
|
protected Caret | createCaret()
Creates a {@link Caret} that should be installed into the text component.
|
protected Highlighter | createHighlighter()
Creates a {@link Highlighter} that should be installed into the text
component.
|
protected Keymap | createKeymap()
Creates the {@link Keymap} that is installed on the text component.
|
void | damageRange(JTextComponent t, int p0, int p1)
Marks the specified range inside the text component's model as
damaged and queues a repaint request.
|
void | damageRange(JTextComponent t, int p0, int p1, Position.Bias firstBias, Position.Bias secondBias)
Marks the specified range inside the text component's model as
damaged and queues a repaint request. |
protected JTextComponent | getComponent()
The text component that is managed by this UI.
|
EditorKit | getEditorKit(JTextComponent t)
Returns the {@link EditorKit} used for the text component that is managed
by this UI.
|
protected String | getKeymapName()
Returns the name of the keymap for this type of TextUI.
|
Dimension | getMaximumSize(JComponent c)
Returns the maximum size for text components that use this UI.
|
Dimension | getMinimumSize(JComponent c)
Returns the minimum size for text components. |
int | getNextVisualPositionFrom(JTextComponent t, int pos, Position.Bias b, int direction, Position.Bias[] biasRet)
Gets the next position inside the document model that is visible on
screen, starting from pos .
|
Dimension | getPreferredSize(JComponent c)
Returns the preferred size of the text component.
|
protected abstract String | getPropertyPrefix()
Returns the property prefix by which the text component's UIDefaults
are looked up.
|
View | getRootView(JTextComponent t)
Returns the root {@link View} of a text component.
|
protected Rectangle | getVisibleEditorRect()
Returns the allocation to give the root view.
|
protected void | installDefaults()
Installs UI defaults on the text components. |
protected void | installKeyboardActions()
Installs the keyboard actions on the text components. |
protected void | installListeners()
Install all listeners on the text component. |
void | installUI(JComponent c)
Installs this UI on the text component.
|
protected void | modelChanged()
Indicates that the model of a text component has changed. |
Rectangle | modelToView(JTextComponent t, int pos)
Maps a position in the document into the coordinate space of the View.
|
Rectangle | modelToView(JTextComponent t, int pos, Position.Bias bias)
Maps a position in the document into the coordinate space of the View.
|
void | paint(Graphics g, JComponent c)
Paints the text component. |
protected void | paintBackground(Graphics g)
Paints the background of the text component.
|
protected void | paintSafely(Graphics g)
This paints the text component while beeing sure that the model is not
modified while painting.
|
protected void | propertyChange(PropertyChangeEvent ev)
Receives notification whenever one of the text component's bound
properties changes. |
protected void | setView(View view)
Sets the root view for the text component.
|
protected void | uninstallDefaults()
Uninstalls all default properties that have previously been installed by
this UI. |
protected void | uninstallKeyboardActions()
Uninstalls all keyboard actions that have previously been installed by
this UI. |
protected void | uninstallListeners()
Uninstalls all listeners that have previously been installed by
this UI. |
void | uninstallUI(JComponent component)
Uninstalls this TextUI from the text component.
|
void | update(Graphics g, JComponent c)
Overridden for better control over background painting. |
int | viewToModel(JTextComponent t, Point pt)
Maps a point in the View coordinate space to a position
inside a document model.
|
int | viewToModel(JTextComponent t, Point pt, Position.Bias[] biasReturn)
Maps a point in the View coordinate space to a position
inside a document model.
|
BasicTextUI
instance.Parameters: elem the Element
to create a View
for
See Also: ViewFactory
Parameters: elem the Element
to create a View
for p0 the start offset p1 the end offset
See Also: ViewFactory
Returns: a caret that should be installed into the text component
Returns: a Highlighter
for the text component
Returns: the {@link Keymap} that is installed on the text component
Parameters: t the text component p0 the start location inside the document model of the range that is damaged p1 the end location inside the document model of the range that is damaged
Parameters: t the text component p0 the start location inside the document model of the range that is damaged p1 the end location inside the document model of the range that is damaged firstBias the bias for the start location secondBias the bias for the end location
Returns: the text component that is managed by this UI
Parameters: t the text component
Returns: the {@link EditorKit} used for the text component that is managed by this UI
Returns: the name of the keymap for this TextUI
Parameters: c not used here
Returns: the maximum size for text components that use this UI
Returns: the minimum size for text components
pos
.
Parameters: t the text component pos the start positionn b the bias for pos direction the search direction biasRet filled by the method to indicate the bias of the return value
Returns: the next position inside the document model that is visible on screen
Parameters: c not used here
Returns: the preferred size of the text component
Returns: the property prefix by which the text component's UIDefaults are looked up
Returns: the root {@link View} of a text component
Returns: the allocation to give the root view
UNKNOWN: The allocation has nothing to do with visibility. According to the specs the naming of this method is unfortunate and has historical reasons
Parameters: c the text component on which to install the UI
Parameters: t the text component pos the position of the character in the model
Returns: a rectangle that gives the location of the document position inside the view coordinate space
Throws: BadLocationException if pos
is invalid IllegalArgumentException if b is not one of the above listed
valid values
Parameters: t the text component pos the position of the character in the model bias either {@link Position.Bias#Forward} or
{@link Position.Bias#Backward} depending on the preferred
direction bias. If null
this defaults to
Position.Bias.Forward
Returns: a rectangle that gives the location of the document position inside the view coordinate space
Throws: BadLocationException if pos
is invalid IllegalArgumentException if b is not one of the above listed
valid values
Parameters: g the Graphics
context to paint to c not used here
Parameters: g the Graphics
context to paint to
Parameters: g the Graphics
context to paint to
Parameters: ev the property change event
Parameters: view the View
to be set as root view
Parameters: component the text component to uninstall the UI from
Parameters: g the graphics to use c the component to be painted
View
coordinate space to a position
inside a document model.
Parameters: t the text component pt the point to be mapped
Returns: the position inside the document model that corresponds to
pt
View
coordinate space to a position
inside a document model.
Parameters: t the text component pt the point to be mapped biasReturn filled in by the method to indicate the bias of the return value
Returns: the position inside the document model that corresponds to
pt