public class BasicEditorUI
extends javax.swing.plaf.basic.BasicEditorPaneUI
BasicEditorUI
overrides the default look and feel for the BasicEditorPane implementation in order to adhere to the locking policies in the document. The default BasicTextUI
implementation makes the assumption that the document model used by the editor pane inherits from AbstractDocument, which is not true in our case. Because of this assumption, none of our locking calls are made when the editor is painted if the installed UI delegate is the Swing default one.Modifier and Type | Method and Description |
---|---|
void |
addPainter(BasicEditorPainter painter) |
protected javax.swing.text.Caret |
createCaret()
Creates the object to use for a caret.
|
static javax.swing.plaf.ComponentUI |
createUI(javax.swing.JComponent component)
Creates a UI for the BasicEditorPane.
|
void |
damageRange(javax.swing.text.JTextComponent component, int startOffset, int endOffset, javax.swing.text.Position.Bias startOffsetBias, javax.swing.text.Position.Bias endOffsetBias)
Causes the portion of the view responsible for the given part of the model to be repainted.
|
java.awt.Dimension |
getMaximumSize(javax.swing.JComponent component)
Gets the maximum size for the editor component.
|
java.awt.Dimension |
getMinimumSize(javax.swing.JComponent component)
Gets the minimum size for the editor component.
|
int |
getNextVisualPositionFrom(javax.swing.text.JTextComponent component, int offset, javax.swing.text.Position.Bias bias, int direction, javax.swing.text.Position.Bias[] biasRet)
Provides a way to determine the next visually represented model location that one might place a caret.
|
java.awt.Dimension |
getPreferredSize(javax.swing.JComponent component)
Gets the preferred size for the editor component.
|
void |
installUI(javax.swing.JComponent component)
Installs the UI for a component.
|
java.awt.Rectangle |
modelToView(javax.swing.text.JTextComponent component, int offset, javax.swing.text.Position.Bias bias)
Converts the given location in the model to a place in the view coordinate system.
|
protected void |
paintBackground(java.awt.Graphics g) |
protected void |
paintSafely(java.awt.Graphics g)
Paints the interface safely with a guarantee that the model won't change from the view of this thread.
|
void |
removePainter(BasicEditorPainter painter) |
int |
viewToModel(javax.swing.text.JTextComponent component, java.awt.Point point, javax.swing.text.Position.Bias[] biasReturn)
Converts the given place in the view coordinate system to the nearest representative location in the model.
|
getEditorKit, getPropertyPrefix, propertyChange, uninstallUI
create, create, createHighlighter, createKeymap, damageRange, getComponent, getKeymapName, getRootView, getToolTipText, getVisibleEditorRect, installDefaults, installKeyboardActions, installListeners, modelChanged, modelToView, paint, setView, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, update, viewToModel
public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent component)
component
- the JTextPane componentpublic void installUI(javax.swing.JComponent component)
installUI
in class javax.swing.plaf.basic.BasicEditorPaneUI
component
- the editor componentComponentUI.installUI(javax.swing.JComponent)
protected javax.swing.text.Caret createCaret()
createCaret
in class javax.swing.plaf.basic.BasicTextUI
protected void paintBackground(java.awt.Graphics g)
paintBackground
in class javax.swing.plaf.basic.BasicTextUI
protected void paintSafely(java.awt.Graphics g)
paintSafely
in class javax.swing.plaf.basic.BasicTextUI
g
- the graphics contextpublic java.awt.Dimension getPreferredSize(javax.swing.JComponent component)
getPreferredSize
in class javax.swing.plaf.basic.BasicTextUI
component
- the editor componentpublic java.awt.Dimension getMinimumSize(javax.swing.JComponent component)
getMinimumSize
in class javax.swing.plaf.basic.BasicTextUI
component
- the editor componentpublic java.awt.Dimension getMaximumSize(javax.swing.JComponent component)
getMaximumSize
in class javax.swing.plaf.basic.BasicTextUI
component
- the editor componentpublic java.awt.Rectangle modelToView(javax.swing.text.JTextComponent component, int offset, javax.swing.text.Position.Bias bias) throws javax.swing.text.BadLocationException
modelToView
in class javax.swing.plaf.basic.BasicTextUI
component
- the text component for which this UI is installedoffset
- the local location in the model to translate >= 0javax.swing.text.BadLocationException
- if the given offset does not represent a valid location in the documentTextUI.modelToView(javax.swing.text.JTextComponent, int)
public int viewToModel(javax.swing.text.JTextComponent component, java.awt.Point point, javax.swing.text.Position.Bias[] biasReturn)
viewToModel
in class javax.swing.plaf.basic.BasicTextUI
component
- the text component for which this UI is installedpoint
- the location in the view to translate. This should be in the same coordinate system as the mouse events.TextUI.viewToModel(javax.swing.text.JTextComponent, java.awt.Point)
public int getNextVisualPositionFrom(javax.swing.text.JTextComponent component, int offset, javax.swing.text.Position.Bias bias, int direction, javax.swing.text.Position.Bias[] biasRet) throws javax.swing.text.BadLocationException
getNextVisualPositionFrom
in class javax.swing.plaf.basic.BasicTextUI
component
- the text component for which this UI is installedoffset
- the position to convert >= 0direction
- the direction from the current position that can be thought of as the arrow keys typically found on a keyboard. This may be SwingConstants.WEST, SwingConstants.EAST, SwingConstants.NORTH, or SwingConstants.SOUTH.javax.swing.text.BadLocationException
- if the given offset does not represent a valid location in the documentjava.lang.IllegalArgumentException
- for an invalid directionpublic void damageRange(javax.swing.text.JTextComponent component, int startOffset, int endOffset, javax.swing.text.Position.Bias startOffsetBias, javax.swing.text.Position.Bias endOffsetBias)
damageRange
in class javax.swing.plaf.basic.BasicTextUI
component
- the text component for which this UI is installedstartOffset
- the beginning of the range >= 0endOffset
- the end of the range >= startOffsetpublic void addPainter(BasicEditorPainter painter)
public void removePainter(BasicEditorPainter painter)