public class TextAreaPainter
extends javax.swing.JComponent
implements javax.swing.text.TabExpander
javax.swing.JComponent.AccessibleJComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
TextAreaPainter(@NotNull JEditTextArea textArea,
@NotNull TextAreaSelection selection,
@NotNull TextAreaCaret caret,
@NotNull TextAreaDefaults defaults,
@NotNull TextAreaBrackets brackets,
@NotNull TextAreaConfig config,
boolean paintInvalid)
Creates a new repaint manager.
|
Modifier and Type | Method and Description |
---|---|
int |
getCurrentLineIndex()
Returns the currently painted line.
|
int |
getDefaultCharWidth()
This works only for fonts with fixed line height.
|
int |
getFirstLine()
Returns the line displayed at the text area's origin.
|
@Nullable java.awt.FontMetrics |
getFontMetrics()
Returns the font metrics used by this component.
|
int |
getHorizontalOffset()
Returns the horizontal offset of drawn lines.
|
@NotNull java.awt.Dimension |
getMinimumSize() |
@NotNull java.awt.Dimension |
getPreferredSize() |
@NotNull SyntaxStyles |
getStyles()
Returns the syntax styles used to paint colorized text.
|
int |
getVisibleLines() |
void |
invalidateLine(int line)
Marks a line as needing a repaint.
|
void |
invalidateLineRange(int firstLine,
int lastLine)
Marks a range of lines as needing a repaint.
|
void |
invalidateSelectedLines()
Repaints the lines containing the selection.
|
boolean |
isBlockCaretEnabled()
Returns whether the caret should be drawn as a block.
|
boolean |
isBracketHighlightEnabled()
Returns whether bracket highlighting is enabled.
|
int |
lineToY(int line)
Converts a line index to a y co-ordinate.
|
float |
nextTabStop(float x,
int tabOffset) |
int |
offsetToX(int line,
int offset)
Converts an offset in a line into an x co-ordinate.
|
int |
offsetToX2(int line,
int offset)
Converts an offset in a line into an x co-ordinate.
|
void |
paint(@NotNull java.awt.Graphics g)
Repaints the text.
|
void |
recalculateVisibleLines()
Recalculates the number of visible lines.
|
void |
setCurrentLineIndex(int lineIndex)
Sets the currently painted line.
|
boolean |
setFirstLine(int firstLine) |
void |
setFont(@NotNull java.awt.Font font) |
boolean |
setHorizontalOffset(int horizontalOffset) |
void |
setStyles(@NotNull SyntaxStyles styles)
Sets the syntax styles used to paint colorized text.
|
int |
xToOffset(int line,
int x)
Converts a x co-ordinate to an offset within a line.
|
int |
xyToOffset(int x,
int y)
Converts a point to an offset, from the start of the text.
|
int |
yToLine(int y)
Converts a y co-ordinate to a line index.
|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public TextAreaPainter(@NotNull @NotNull JEditTextArea textArea, @NotNull @NotNull TextAreaSelection selection, @NotNull @NotNull TextAreaCaret caret, @NotNull @NotNull TextAreaDefaults defaults, @NotNull @NotNull TextAreaBrackets brackets, @NotNull @NotNull TextAreaConfig config, boolean paintInvalid)
textArea
- the associated text area that is painteddefaults
- the text attributes to usebrackets
- the brackets to paintconfig
- the text area configuration options to usepaintInvalid
- whether invalid lines should be painted as red
tildespublic int getDefaultCharWidth()
@NotNull public @NotNull SyntaxStyles getStyles()
Token
public void setStyles(@NotNull @NotNull SyntaxStyles styles)
styles
- the syntax stylesToken
public boolean isBracketHighlightEnabled()
public boolean isBlockCaretEnabled()
@Nullable public @Nullable java.awt.FontMetrics getFontMetrics()
public final void setFont(@NotNull @NotNull java.awt.Font font)
setFont
in class javax.swing.JComponent
public void paint(@NotNull @NotNull java.awt.Graphics g)
paint
in class javax.swing.JComponent
g
- the graphics contextpublic void invalidateLine(int line)
line
- the line to invalidatepublic void invalidateLineRange(int firstLine, int lastLine)
firstLine
- the first line to invalidatelastLine
- the last line to invalidatepublic void invalidateSelectedLines()
public float nextTabStop(float x, int tabOffset)
nextTabStop
in interface javax.swing.text.TabExpander
@NotNull public @NotNull java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
@NotNull public @NotNull java.awt.Dimension getMinimumSize()
getMinimumSize
in class javax.swing.JComponent
public int getCurrentLineIndex()
public void setCurrentLineIndex(int lineIndex)
lineIndex
- the line indexpublic void recalculateVisibleLines()
public int getVisibleLines()
public int getFirstLine()
public boolean setFirstLine(int firstLine)
public int lineToY(int line)
line
- the linepublic int getHorizontalOffset()
public boolean setHorizontalOffset(int horizontalOffset)
public int offsetToX2(int line, int offset)
line
- the lineoffset
- the offset, from the start of the linepublic int offsetToX(int line, int offset)
line
- the lineoffset
- the offset, from the start of the linepublic int yToLine(int y)
y
- the y co-ordinatepublic int xToOffset(int line, int x)
line
- the linex
- the x co-ordinatepublic int xyToOffset(int x, int y)
x
- the x co-ordinate of the pointy
- the y co-ordinate of the point