org.gjt.sp.jedit.syntax
Class SyntaxView
- java.lang.Object
-
- javax.swing.text.View
-
- javax.swing.text.PlainView
-
- org.gjt.sp.jedit.syntax.SyntaxView
-
- All Implemented Interfaces:
- javax.swing.SwingConstants, javax.swing.text.TabExpander
public class SyntaxView extends javax.swing.text.PlainViewA Swing view implementation that colorizes lines of aSyntaxDocumentusing aTokenMarker.This class should not be used directly; a
SyntaxEditorKitshould be used instead.
-
-
Field Summary
-
Constructor Summary
Constructors Constructor and Description SyntaxView(javax.swing.text.Element elem)Creates a newSyntaxViewfor painting the specified element.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voiddrawLine(int lineIndex, java.awt.Graphics g, int x, int y)Paints the specified line.-
Methods inherited from class javax.swing.text.PlainView
changedUpdate, getPreferredSpan, insertUpdate, modelToView, nextTabStop, paint, removeUpdate, setSize, viewToModel
-
Methods inherited from class javax.swing.text.View
append, breakView, createFragment, getAlignment, getAttributes, getBreakWeight, getChildAllocation, getContainer, getDocument, getElement, getEndOffset, getGraphics, getMaximumSpan, getMinimumSpan, getNextVisualPositionFrom, getParent, getResizeWeight, getStartOffset, getToolTipText, getView, getViewCount, getViewFactory, getViewIndex, getViewIndex, insert, isVisible, modelToView, modelToView, preferenceChanged, remove, removeAll, replace, setParent, viewToModel
-
-
-
-
Constructor Detail
-
SyntaxView
public SyntaxView(javax.swing.text.Element elem)
Creates a newSyntaxViewfor painting the specified element.- Parameters:
elem- The element
-
-
Method Detail
-
drawLine
public void drawLine(int lineIndex, java.awt.Graphics g, int x, int y)Paints the specified line.This method performs the following:
- Gets the token marker and color table from the current document,
typecast to a
SyntaxDocument. - Tokenizes the required line by calling the
markTokens()method of the token marker. - Paints each token, obtaining the color by looking up the
the
Token.idvalue in the color table.
SyntaxDocument, or if the returned token marker is null, the line will be painted with no colorization.- Overrides:
drawLinein classjavax.swing.text.PlainView- Parameters:
lineIndex- The line numberg- The graphics contextx- The x co-ordinate where the line should be paintedy- The y co-ordinate where the line should be painted
- Gets the token marker and color table from the current document,
typecast to a
-
-
DataMelt 3.0 © DataMelt by jWork.ORG