public class TextAreaPainter
extends javax.swing.JComponent
implements javax.swing.text.TabExpander
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
static int |
BACKGROUND_LAYER
Below selection layer.
|
static int |
BELOW_MOST_EXTENSIONS_LAYER
Below most extensions layer.
|
static int |
BELOW_SELECTION_LAYER
Below selection layer.
|
static int |
BLOCK_CARET_LAYER
Block caret layer.
|
static int |
BRACKET_HIGHLIGHT_LAYER
Bracket highlight layer.
|
static int |
CARET_LAYER
Caret layer.
|
static int |
DEFAULT_LAYER
Default extension layer.
|
static int |
HIGHEST_LAYER
Highest possible layer.
|
static int |
LINE_BACKGROUND_LAYER
The line highlight and collapsed fold highlight layer.
|
static int |
LOWEST_LAYER
The lowest possible layer.
|
static int |
SELECTION_LAYER
Selection layer.
|
static int |
TEXT_LAYER
Text layer.
|
static int |
WRAP_GUIDE_LAYER
Wrap guide layer.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Modifier and Type | Method and Description |
---|---|
void |
addExtension(int layer,
TextAreaExtension extension)
Adds a text area extension, which can perform custom painting and
tool tip handling.
|
void |
addExtension(TextAreaExtension extension)
Adds a text area extension, which can perform custom painting and
tool tip handling.
|
void |
addNotify() |
AntiAlias |
getAntiAlias() |
java.awt.Color |
getCaretColor()
Returns the caret color.
|
java.lang.String |
getEOLMarkerChar() |
java.awt.Color |
getEOLMarkerColor()
Returns the EOL marker color.
|
boolean |
getEOLMarkersPainted()
Returns true if EOL markers are drawn, false otherwise.
|
TextAreaExtension[] |
getExtensions()
Returns an array of registered text area extensions.
|
boolean |
getFocusTraversalKeysEnabled()
Makes the tab key work in Java 1.4.
|
SyntaxStyle[] |
getFoldLineStyle()
Returns the fold line style.
|
int |
getFontHeight()
Returns the font height as given by the font metrics.
|
java.awt.FontMetrics |
getFontMetrics()
Returns the font metrics used by this component.
|
java.awt.font.FontRenderContext |
getFontRenderContext()
Returns the font render context.
|
int |
getLineExtraSpacing()
Returns the number of pixels from the start of the line to the start
of text (the extra line spacing).
|
int |
getLineHeight()
Returns the line height as given by the font metrics plus the
added line spacing.
|
java.awt.Color |
getLineHighlightColor()
Returns the line highlight color.
|
java.awt.Dimension |
getMinimumSize()
Returns the painter's minimum size.
|
java.awt.Color |
getMultipleSelectionColor()
Returns the multiple selection color.
|
java.awt.Dimension |
getPreferredSize()
Returns the painter's preferred size.
|
java.awt.RenderingHints |
getRenderingHints()
Returns the rendering hints used by the Graphics2D class; in this
case, for anti-aliasing of text.
|
java.awt.Color |
getSelectionColor()
Returns the selection color.
|
java.awt.Color |
getSelectionFgColor()
Returns the selection foreground color, if one is set.
|
float |
getStringWidth(java.lang.String str)
Returns the width of the given string, in pixels, using the text
area's current font.
|
java.awt.Color |
getStructureHighlightColor()
Returns the structure highlight color.
|
SyntaxStyle[] |
getStyles()
Returns the syntax styles used to paint colorized text.
|
java.lang.String |
getToolTipText(java.awt.event.MouseEvent evt)
Returns the tool tip to display at the specified location.
|
java.awt.Color |
getWrapGuideColor()
Returns the wrap guide color.
|
boolean |
isBlockCaretEnabled()
Returns true if the caret should be drawn as a block, false otherwise.
|
boolean |
isFractionalFontMetricsEnabled()
Returns if fractional font metrics are enabled.
|
boolean |
isLineHighlightEnabled()
Returns true if line highlight is enabled, false otherwise.
|
boolean |
isSelectionFgColorEnabled()
Returns true if selection foreground color is enabled - i.e.
|
boolean |
isStructureHighlightEnabled()
Returns true if structure highlighting is enabled, false otherwise.
|
boolean |
isThickCaretEnabled()
Returns true if the caret should be drawn with a thick line, false otherwise.
|
boolean |
isWrapGuidePainted()
Returns true if the wrap guide is drawn, false otherwise.
|
float |
nextTabStop(float x,
int tabOffset)
Implementation of TabExpander interface.
|
void |
paint(java.awt.Graphics _gfx)
Repaints the text.
|
void |
removeExtension(TextAreaExtension extension)
Removes a text area extension.
|
void |
resetCursor()
Reset the cursor to it's default value.
|
void |
setAntiAlias(AntiAlias newValue)
As of jEdit 4.3, subpixel antialias mode is supported.
|
void |
setBlockCaretEnabled(boolean blockCaret)
Sets if the caret should be drawn as a block, false otherwise.
|
void |
setBounds(int x,
int y,
int width,
int height)
It is a bad idea to override this, but we need to get the component
event before the first repaint.
|
void |
setCaretColor(java.awt.Color caretColor)
Sets the caret color.
|
void |
setCursor(java.awt.Cursor cursor)
Change the mouse cursor.
|
void |
setEOLMarkerChar(java.lang.String emc) |
void |
setEOLMarkerColor(java.awt.Color eolMarkerColor)
Sets the EOL marker color.
|
void |
setEOLMarkersPainted(boolean eolMarkers)
Sets if EOL markers are to be drawn.
|
void |
setFoldLineStyle(SyntaxStyle[] foldLineStyle)
Sets the fold line style.
|
void |
setFont(java.awt.Font font)
Sets the font for this component.
|
void |
setFractionalFontMetricsEnabled(boolean fracFontMetrics)
Sets if fractional font metrics should be enabled.
|
void |
setLineExtraSpacing(int spacing)
Sets extra spacing between lines in pixels.
|
void |
setLineHighlightColor(java.awt.Color lineHighlightColor)
Sets the line highlight color.
|
void |
setLineHighlightEnabled(boolean lineHighlight)
Enables or disables current line highlighting.
|
void |
setMultipleSelectionColor(java.awt.Color multipleSelectionColor)
Sets the multiple selection color.
|
void |
setSelectionColor(java.awt.Color selectionColor)
Sets the selection color.
|
void |
setSelectionFgColor(java.awt.Color selectionFgColor)
Sets the selection foreground color.
|
void |
setSelectionFgColorEnabled(boolean selectionFg)
Enables or disables selection foreground color.
|
void |
setStructureHighlightColor(java.awt.Color structureHighlightColor)
Sets the structure highlight color.
|
void |
setStructureHighlightEnabled(boolean structureHighlight)
Enables or disables structure highlighting.
|
void |
setStyles(SyntaxStyle[] styles)
Sets the syntax styles used to paint colorized text.
|
void |
setThickCaretEnabled(boolean thickCaret)
Sets if the caret should be drawn with a thick line.
|
void |
setWrapGuideColor(java.awt.Color wrapGuideColor)
Sets the wrap guide color.
|
void |
setWrapGuidePainted(boolean wrapGuide)
Sets if the wrap guide is to be drawn.
|
void |
update(java.awt.Graphics _gfx)
Repaints the text.
|
addAncestorListener, 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, 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, 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, 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, setComponentOrientation, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final int LOWEST_LAYER
addExtension(int,TextAreaExtension)
,
Constant Field Valuespublic static final int BACKGROUND_LAYER
addExtension(int,TextAreaExtension)
,
Constant Field Valuespublic static final int LINE_BACKGROUND_LAYER
addExtension(int,TextAreaExtension)
,
Constant Field Valuespublic static final int BELOW_SELECTION_LAYER
addExtension(int,TextAreaExtension)
,
Constant Field Valuespublic static final int SELECTION_LAYER
addExtension(int,TextAreaExtension)
,
Constant Field Valuespublic static final int WRAP_GUIDE_LAYER
public static final int BELOW_MOST_EXTENSIONS_LAYER
addExtension(int,TextAreaExtension)
,
Constant Field Valuespublic static final int DEFAULT_LAYER
public static final int BLOCK_CARET_LAYER
public static final int BRACKET_HIGHLIGHT_LAYER
public static final int TEXT_LAYER
public static final int CARET_LAYER
public static final int HIGHEST_LAYER
public void setBounds(int x, int y, int width, int height)
setBounds
in class java.awt.Component
public void addNotify()
addNotify
in class javax.swing.JComponent
public void setCursor(java.awt.Cursor cursor)
resetCursor()
is called.setCursor
in class java.awt.Component
cursor
- the new cursorpublic void resetCursor()
public boolean getFocusTraversalKeysEnabled()
getFocusTraversalKeysEnabled
in class java.awt.Component
public final SyntaxStyle[] getStyles()
Token
public final void setStyles(SyntaxStyle[] styles)
styles
- The syntax stylesToken
public final java.awt.Color getCaretColor()
public final void setCaretColor(java.awt.Color caretColor)
caretColor
- The caret colorpublic final java.awt.Color getSelectionColor()
public final void setSelectionColor(java.awt.Color selectionColor)
selectionColor
- The selection colorpublic final java.awt.Color getMultipleSelectionColor()
public final void setMultipleSelectionColor(java.awt.Color multipleSelectionColor)
multipleSelectionColor
- The multiple selection colorpublic final java.awt.Color getLineHighlightColor()
public final void setLineHighlightColor(java.awt.Color lineHighlightColor)
lineHighlightColor
- The line highlight colorpublic final boolean isLineHighlightEnabled()
public final void setLineHighlightEnabled(boolean lineHighlight)
lineHighlight
- True if current line highlight should be enabled,
false otherwisepublic final java.awt.Color getSelectionFgColor()
public final void setSelectionFgColor(java.awt.Color selectionFgColor)
selectionFgColor
- The selection foreground colorpublic final boolean isSelectionFgColorEnabled()
public final void setSelectionFgColorEnabled(boolean selectionFg)
selectionFg
- True if selection foreground should be enabled,
false otherwisepublic final java.awt.Color getStructureHighlightColor()
public final void setStructureHighlightColor(java.awt.Color structureHighlightColor)
structureHighlightColor
- The bracket highlight colorpublic final boolean isStructureHighlightEnabled()
public final void setStructureHighlightEnabled(boolean structureHighlight)
structureHighlight
- True if structure highlighting should be
enabled, false otherwisepublic final boolean isBlockCaretEnabled()
public final void setBlockCaretEnabled(boolean blockCaret)
blockCaret
- True if the caret should be drawn as a block,
false otherwise.public final boolean isThickCaretEnabled()
public final void setThickCaretEnabled(boolean thickCaret)
thickCaret
- True if the caret should be drawn as a block, false otherwise.public java.lang.String getEOLMarkerChar()
public void setEOLMarkerChar(java.lang.String emc)
public final java.awt.Color getEOLMarkerColor()
public final void setEOLMarkerColor(java.awt.Color eolMarkerColor)
eolMarkerColor
- The EOL marker colorpublic final boolean getEOLMarkersPainted()
public final void setEOLMarkersPainted(boolean eolMarkers)
eolMarkers
- True if EOL markers should be drawn, false otherwisepublic final java.awt.Color getWrapGuideColor()
public final void setWrapGuideColor(java.awt.Color wrapGuideColor)
wrapGuideColor
- The wrap guide colorpublic final boolean isWrapGuidePainted()
public final void setWrapGuidePainted(boolean wrapGuide)
wrapGuide
- True if the wrap guide should be drawn, false otherwisepublic final SyntaxStyle[] getFoldLineStyle()
public final void setFoldLineStyle(SyntaxStyle[] foldLineStyle)
foldLineStyle
- The fold line stylepublic void setAntiAlias(AntiAlias newValue)
public AntiAlias getAntiAlias()
public void setFractionalFontMetricsEnabled(boolean fracFontMetrics)
public boolean isFractionalFontMetricsEnabled()
public java.awt.font.FontRenderContext getFontRenderContext()
public void addExtension(TextAreaExtension extension)
extension
- The extensionpublic void addExtension(int layer, TextAreaExtension extension)
layer
- The layer to add the extension to. Note that more than
extension can share the same layer.extension
- The extensionpublic void removeExtension(TextAreaExtension extension)
extension
- The extensionpublic TextAreaExtension[] getExtensions()
public java.lang.String getToolTipText(java.awt.event.MouseEvent evt)
getToolTipText
in class javax.swing.JComponent
evt
- The mouse eventpublic java.awt.FontMetrics getFontMetrics()
public int getLineHeight()
public int getFontHeight()
public int getLineExtraSpacing()
public void setLineExtraSpacing(int spacing)
public void setFont(java.awt.Font font)
setFont
in class javax.swing.JComponent
font
- The fontpublic float getStringWidth(java.lang.String str)
public java.awt.RenderingHints getRenderingHints()
public void update(java.awt.Graphics _gfx)
update
in class javax.swing.JComponent
_gfx
- The graphics contextpublic void paint(java.awt.Graphics _gfx)
paint
in class javax.swing.JComponent
_gfx
- The graphics contextpublic float nextTabStop(float x, int tabOffset)
nextTabStop
in interface javax.swing.text.TabExpander
x
- The x co-ordinatetabOffset
- Ignoredpublic java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class javax.swing.JComponent