|
|||||||||
| Home >> All >> novaworx >> [ textpane overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
novaworx.textpane
Class SyntaxTextPane

java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.text.JTextComponent
javax.swing.JEditorPane
novaworx.textpane.SyntaxTextPane
- All Implemented Interfaces:
- javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.Scrollable, java.io.Serializable
- public class SyntaxTextPane
- extends javax.swing.JEditorPane
The SyntaxTextPane is a powerful set of classes for editing primarily
text. It may be adapted to handle editing of binary files at a future date.
The SyntaxTextPane was derived from two versions of the program
jEdit written by Slava Pestov.
- Since:
- Novaworx 1.0
| Nested Class Summary | |
(package private) class |
SyntaxTextPane.BlockCaretHighlighter
A Highlighter.HighlightPainter to paint the caret. |
(package private) class |
SyntaxTextPane.BracketHighlighter
A HighLighter to highlight bracket matches. |
(package private) class |
SyntaxTextPane.CurrentLineHighlighter
A HighLighter to highlight the current line. |
private static class |
SyntaxTextPane.DefaultKeyTypedAction
The default action for typing a key, modified for the Syntax. |
private static class |
SyntaxTextPane.DeleteAction
The delete action. |
(package private) class |
SyntaxTextPane.EditorCaret
The Caret for the SyntaxTextPane. |
private static class |
SyntaxTextPane.IndentAction
The indent action. |
private static class |
SyntaxTextPane.InsertKeyAction
|
private static class |
SyntaxTextPane.MouseMotionHandler
A mouse listener to set the cursor back to a text cursor. |
private static class |
SyntaxTextPane.RedoAction
The redo action. |
(package private) class |
SyntaxTextPane.SafeScroller
A scroller that works with the text pane. |
(package private) class |
SyntaxTextPane.SelectionHighlighter
A HighLighter to highlight the selection. |
private static class |
SyntaxTextPane.UndoAction
The undo action. |
private static class |
SyntaxTextPane.UnindentAction
The unindent action. |
| Nested classes inherited from class javax.swing.JEditorPane |
javax.swing.JEditorPane.AccessibleJEditorPane, javax.swing.JEditorPane.AccessibleJEditorPaneHTML, javax.swing.JEditorPane.JEditorPaneAccessibleHypertextSupport |
| Nested classes inherited from class javax.swing.text.JTextComponent |
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.KeyBinding |
| Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
static javax.swing.text.EditorKit |
EDITOR_KIT
The default editor kit for this text component. |
private boolean |
mbAntiAlias
|
private boolean |
mbBlock
|
private boolean |
mbBlockSelect
|
private static boolean |
mbKeymapInitialized
|
private boolean |
mbOverwrite
|
private double |
mdScrollToPercentFromTop
|
private int |
miBracketLine
|
private int |
miElectricLines
|
private int |
miLastBracketPosition
|
private int |
miLastLine
|
private int |
miLastOtherBracketPosition
|
private int |
miOtherBracketLine
|
private int |
miTabSize
|
private java.lang.Object |
moBlockCaretHighlightTag
|
private java.awt.Color |
moBracketHighlightColor
|
private java.lang.Object |
moBracketHighlightTag
|
private java.awt.Color |
moLineHighlightColor
|
private java.lang.Object |
moLineHighlightTag
|
private static java.awt.Cursor |
moNoCursor
|
private java.lang.Object |
moOtherBracketHighlightTag
|
private static java.awt.Cursor |
moTextCursor
|
private java.lang.String |
msSyntax
|
static java.lang.String |
STYLES_ATTRIBUTE
|
| Fields inherited from class javax.swing.JEditorPane |
|
| Fields inherited from class javax.swing.text.JTextComponent |
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY |
| Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Container |
|
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
SyntaxTextPane()
Create a new SyntaxTextPane component without syntax highlighting by default. |
|
| Method Summary | |
private void |
_replaceSelection(java.lang.String asContent)
Another implementation of the replaceSelection method
made specifically for the Syntax. |
javax.swing.text.EditorKit |
createDefaultEditorKit()
Returns the default editor kit for this text component. |
void |
doElectricScroll(java.awt.Rectangle aoArea)
|
boolean |
findNext(java.lang.String asExpression)
Find the next occurance of the search expression starting at the specified offset. |
boolean |
findNext(java.lang.String asExpression,
int aiOffset)
Find the next occurance of the search expression starting at the specified offset. |
boolean |
findNext(java.lang.String asExpression,
int aiOffset,
boolean abWrap)
Find the next occurance of the search expression starting at the specified offset. |
boolean |
findPrevious(java.lang.String asExpression)
Find the previous occurance of the search expression starting at the specified offset. |
boolean |
findPrevious(java.lang.String asExpression,
int aiOffset)
Find the previous occurance of the search expression starting at the specified offset. |
boolean |
findPrevious(java.lang.String asExpression,
int aiOffset,
boolean abWrap)
Find the previous occurance of the search expression starting at the specified offset. |
boolean |
getBracketHighlight()
Returns true if bracket highlighting is enabled, false otherwise. |
java.awt.Color |
getBracketHighlightColor()
Returns the bracket highlight color. |
int |
getBracketLineIndex()
Get the line index of the upper bracket. |
int |
getCaretLineIndex()
Get the line index of the caret. |
int |
getCaretOffDelay()
Get the caret off time. |
int |
getCaretOnDelay()
Get the caret on time. |
int |
getCurrentColumn()
Get the current column. |
int |
getCurrentRow()
Get the current row. |
static SyntaxStyle[] |
getDefaultSyntaxStyles()
Returns the default style table. |
int |
getElectricBorder()
Returns the number of lines from the top or bottom of the text area from which autoscrolling begins. |
int |
getEndOffsetForLineIndex(int aiIndex)
Get the end offset for the specified line index. |
int |
getLineCount()
Get the number of lines in the document. |
int |
getLineHeight()
|
boolean |
getLineHighlight()
Returns true if current line highlighting is enabled, false otherwise. |
java.awt.Color |
getLineHighlightColor()
Returns the line highlight color. |
int |
getLineIndexForOffset(int aiOffset)
Get the line index for the specified offset. |
int |
getOtherBracketLineIndex()
Get the line index of the lower bracket. |
boolean |
getOverwrite()
Returns true if overwrite syntax is enabled, false otherwise. |
int |
getScrollableUnitIncrement(java.awt.Rectangle aoVisibleArea,
int aiOrientation,
int aiDirection)
A unit is the height of one line of text. |
double |
getScrollToPercentFromTop()
Set the scroll to percent from top. |
int |
getStartOffsetForLineIndex(int aiIndex)
Get the start offset for the specified line index. |
novaworx.syntax.Syntax |
getSyntax()
Returns the syntax that is to be used to split lines of this document up into tokens. |
SyntaxDocument |
getSyntaxDocument()
Returns the text area's document, typecast to a SyntaxDocument. |
java.lang.String |
getSyntaxName()
Get the name of the syntax being used. |
SyntaxStyle[] |
getSyntaxStyles()
Returns the style array. |
int |
getTabSize()
Get the tab size for the editor. |
boolean |
isAntiAlias()
Get the anit-alias flag. |
boolean |
isBlockCaret()
Returns true if a block caret is enabled, false otherwise. |
boolean |
isBlockSelect()
Get the block select flag. |
boolean |
jumpToLineNumber(int aiLineNumber)
Jump to the specified line number. |
void |
jumpToOffset(int aiOffset)
Jump to the specified offset. |
boolean |
moveToLineNumber(int aiLineNumber)
Move to the specified line number. |
void |
moveToOffset(int aiOffset)
Jump to the specified offset. |
void |
paint(java.awt.Graphics aoGraphics)
Paint the component. |
void |
scrollRectToVisible(java.awt.Rectangle moArea)
Overrides scrollRectToVisible( moArea ). |
void |
scrollToOffset(int aiOffset)
Scroll to the specified offset. |
void |
setAntiAlias(boolean abAntiAlias)
Set the anti-alias flag. |
void |
setBackground(java.awt.Color aoColor)
Set the background color. |
void |
setBlockCaret(boolean abBlockCaret)
Sets the block caret. |
void |
setBlockCaretHighlight(int aiPosition)
Sets the block caret highlight position. |
void |
setBlockSelect(boolean abBlockSelect)
Set the block select flag. |
void |
setBracketHighlight(boolean abBracketHighlight)
Sets the bracket highlighting feature. |
void |
setBracketHighlightColor(java.awt.Color aoColor)
Sets the bracket highlight color. |
void |
setCaretOffDelay(int aiDelay)
Set the caret off time. |
void |
setCaretOnDelay(int aiDelay)
Set the caret on time. |
void |
setDocument(javax.swing.text.Document aoDocument)
Sets the document edited by this text area. |
void |
setElectricBorder(int aiLines)
Sets the number of lines from the top or bottom of the text area from which autoscroll begins. |
void |
setForeground(java.awt.Color aoColor)
Set the foreground color. |
void |
setHighlightedBracket(int aiBracketPosition)
Sets the highlighted bracket. |
void |
setHighlightedLine(int aiLineStart,
int aiLineEnd)
Sets the currently highlighted line. |
void |
setLineHighlight(boolean abLineHighlight)
Sets the current line highlighting feature. |
void |
setLineHighlightColor(java.awt.Color aoColor)
Sets the line highlight color. |
void |
setOtherHighlightedBracket(int aiOtherBracketPosition)
Sets the other highlighted bracket. |
void |
setOverwrite(boolean abOverwrite)
Sets the overwrite syntax. |
void |
setScrollToPercentFromTop(double adPercent)
Set the scroll to percent from top. |
void |
setSyntax(java.lang.String asSyntax)
Sets the syntax that is to be used to split lines of this document up into tokens. |
void |
setSyntax(novaworx.syntax.Syntax aoSyntax)
Sets the syntax that is to be used to split lines of this document up into tokens. |
void |
setSyntaxStyles(SyntaxStyle[] aaStyles)
Sets the style array. |
void |
setTabSize(int aiTabSize)
Set the tab size for the editor. |
boolean |
toggleBlockSelect()
Toggle the block select flag. |
boolean |
toggleOverwrite()
Sets the overwrite syntax flag to the opposite of it's current value. |
void |
updateHighlighters()
Updates the highlighters. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
EDITOR_KIT
public static final javax.swing.text.EditorKit EDITOR_KIT
- The default editor kit for this text component.
STYLES_ATTRIBUTE
public static final java.lang.String STYLES_ATTRIBUTE
- See Also:
- Constant Field Values
mbKeymapInitialized
private static boolean mbKeymapInitialized
msSyntax
private java.lang.String msSyntax
mbAntiAlias
private boolean mbAntiAlias
moLineHighlightColor
private java.awt.Color moLineHighlightColor
moLineHighlightTag
private java.lang.Object moLineHighlightTag
miBracketLine
private int miBracketLine
miOtherBracketLine
private int miOtherBracketLine
moBracketHighlightColor
private java.awt.Color moBracketHighlightColor
moBracketHighlightTag
private java.lang.Object moBracketHighlightTag
moOtherBracketHighlightTag
private java.lang.Object moOtherBracketHighlightTag
moBlockCaretHighlightTag
private java.lang.Object moBlockCaretHighlightTag
miTabSize
private int miTabSize
miElectricLines
private int miElectricLines
mbBlock
private boolean mbBlock
mbOverwrite
private boolean mbOverwrite
mbBlockSelect
private boolean mbBlockSelect
miLastLine
private int miLastLine
miLastBracketPosition
private int miLastBracketPosition
miLastOtherBracketPosition
private int miLastOtherBracketPosition
mdScrollToPercentFromTop
private double mdScrollToPercentFromTop
moNoCursor
private static java.awt.Cursor moNoCursor
moTextCursor
private static java.awt.Cursor moTextCursor
| Constructor Detail |
SyntaxTextPane
public SyntaxTextPane()
- Create a new
SyntaxTextPanecomponent without syntax highlighting by default.
| Method Detail |
createDefaultEditorKit
public javax.swing.text.EditorKit createDefaultEditorKit()
- Returns the default editor kit for this text component.
setAntiAlias
public void setAntiAlias(boolean abAntiAlias)
- Set the anti-alias flag.
isAntiAlias
public boolean isAntiAlias()
- Get the anit-alias flag.
setHighlightedLine
public void setHighlightedLine(int aiLineStart,
int aiLineEnd)
- Sets the currently highlighted line.
setLineHighlightColor
public void setLineHighlightColor(java.awt.Color aoColor)
- Sets the line highlight color.
getLineHighlightColor
public java.awt.Color getLineHighlightColor()
- Returns the line highlight color.
setLineHighlight
public void setLineHighlight(boolean abLineHighlight)
- Sets the current line highlighting feature.
getLineHighlight
public boolean getLineHighlight()
- Returns true if current line highlighting is enabled, false
otherwise.
setHighlightedBracket
public void setHighlightedBracket(int aiBracketPosition)
- Sets the highlighted bracket.
setOtherHighlightedBracket
public void setOtherHighlightedBracket(int aiOtherBracketPosition)
- Sets the other highlighted bracket.
setBracketHighlightColor
public void setBracketHighlightColor(java.awt.Color aoColor)
- Sets the bracket highlight color.
getBracketHighlightColor
public java.awt.Color getBracketHighlightColor()
- Returns the bracket highlight color.
setBracketHighlight
public void setBracketHighlight(boolean abBracketHighlight)
- Sets the bracket highlighting feature.
getBracketHighlight
public boolean getBracketHighlight()
- Returns true if bracket highlighting is enabled, false otherwise.
setElectricBorder
public void setElectricBorder(int aiLines)
- Sets the number of lines from the top or bottom of the
text area from which autoscroll begins.
getElectricBorder
public int getElectricBorder()
- Returns the number of lines from the top or bottom of the
text area from which autoscrolling begins.
setBlockCaret
public void setBlockCaret(boolean abBlockCaret)
- Sets the block caret.
isBlockCaret
public boolean isBlockCaret()
- Returns true if a block caret is enabled, false otherwise.
setBlockCaretHighlight
public void setBlockCaretHighlight(int aiPosition)
- Sets the block caret highlight position.
setCaretOnDelay
public void setCaretOnDelay(int aiDelay)
- Set the caret on time.
getCaretOnDelay
public int getCaretOnDelay()
- Get the caret on time.
setCaretOffDelay
public void setCaretOffDelay(int aiDelay)
- Set the caret off time.
getCaretOffDelay
public int getCaretOffDelay()
- Get the caret off time.
setTabSize
public void setTabSize(int aiTabSize)
- Set the tab size for the editor.
getTabSize
public int getTabSize()
- Get the tab size for the editor.
setOverwrite
public void setOverwrite(boolean abOverwrite)
- Sets the overwrite syntax.
getOverwrite
public boolean getOverwrite()
- Returns true if overwrite syntax is enabled, false otherwise.
toggleOverwrite
public boolean toggleOverwrite()
- Sets the overwrite syntax flag to the opposite of it's
current value.
setBlockSelect
public void setBlockSelect(boolean abBlockSelect)
- Set the block select flag.
isBlockSelect
public boolean isBlockSelect()
- Get the block select flag.
toggleBlockSelect
public boolean toggleBlockSelect()
- Toggle the block select flag.
getScrollableUnitIncrement
public int getScrollableUnitIncrement(java.awt.Rectangle aoVisibleArea, int aiOrientation, int aiDirection)
- A unit is the height of one line of text.
updateHighlighters
public void updateHighlighters()
- Updates the highlighters.
getCurrentRow
public int getCurrentRow()
- Get the current row.
getCurrentColumn
public int getCurrentColumn()
- Get the current column.
getBracketLineIndex
public int getBracketLineIndex()
- Get the line index of the upper bracket.
getOtherBracketLineIndex
public int getOtherBracketLineIndex()
- Get the line index of the lower bracket.
getCaretLineIndex
public int getCaretLineIndex()
- Get the line index of the caret.
getLineCount
public int getLineCount()
- Get the number of lines in the document.
getLineIndexForOffset
public int getLineIndexForOffset(int aiOffset)
- Get the line index for the specified offset.
getStartOffsetForLineIndex
public int getStartOffsetForLineIndex(int aiIndex)
- Get the start offset for the specified line index.
getEndOffsetForLineIndex
public int getEndOffsetForLineIndex(int aiIndex)
- Get the end offset for the specified line index.
setDocument
public void setDocument(javax.swing.text.Document aoDocument)
- Sets the document edited by this text area. This method
makes sure that it implements the
SyntaxDocumentinterface.
getSyntaxDocument
public SyntaxDocument getSyntaxDocument()
- Returns the text area's document, typecast to a
SyntaxDocument.
setSyntax
public void setSyntax(java.lang.String asSyntax)
- Sets the syntax that is to be used to split lines of
this document up into tokens.
setSyntax
public void setSyntax(novaworx.syntax.Syntax aoSyntax)
- Sets the syntax that is to be used to split lines of
this document up into tokens.
getSyntax
public novaworx.syntax.Syntax getSyntax()
- Returns the syntax that is to be used to split lines
of this document up into tokens.
getSyntaxName
public java.lang.String getSyntaxName()
- Get the name of the syntax being used.
setSyntaxStyles
public void setSyntaxStyles(SyntaxStyle[] aaStyles)
- Sets the style array.
getSyntaxStyles
public SyntaxStyle[] getSyntaxStyles()
- Returns the style array.
doElectricScroll
public void doElectricScroll(java.awt.Rectangle aoArea)
getLineHeight
public int getLineHeight()
paint
public void paint(java.awt.Graphics aoGraphics)
- Paint the component.
setForeground
public void setForeground(java.awt.Color aoColor)
- Set the foreground color.
setBackground
public void setBackground(java.awt.Color aoColor)
- Set the background color.
getDefaultSyntaxStyles
public static SyntaxStyle[] getDefaultSyntaxStyles()
- Returns the default style table. This can be passed to
SyntaxTextPane.setStyles().
scrollRectToVisible
public void scrollRectToVisible(java.awt.Rectangle moArea)
- Overrides scrollRectToVisible( moArea ).
setScrollToPercentFromTop
public void setScrollToPercentFromTop(double adPercent)
- Set the scroll to percent from top.
getScrollToPercentFromTop
public double getScrollToPercentFromTop()
- Set the scroll to percent from top.
scrollToOffset
public void scrollToOffset(int aiOffset)
- Scroll to the specified offset.
jumpToOffset
public void jumpToOffset(int aiOffset)
- Jump to the specified offset.
moveToOffset
public void moveToOffset(int aiOffset)
- Jump to the specified offset.
jumpToLineNumber
public boolean jumpToLineNumber(int aiLineNumber)
- Jump to the specified line number.
moveToLineNumber
public boolean moveToLineNumber(int aiLineNumber)
- Move to the specified line number.
findNext
public boolean findNext(java.lang.String asExpression)
- Find the next occurance of the search expression starting at the specified offset.
findNext
public boolean findNext(java.lang.String asExpression, int aiOffset)
- Find the next occurance of the search expression starting at the specified offset.
findNext
public boolean findNext(java.lang.String asExpression, int aiOffset, boolean abWrap)
- Find the next occurance of the search expression starting at the specified offset.
findPrevious
public boolean findPrevious(java.lang.String asExpression)
- Find the previous occurance of the search expression starting at the specified offset.
findPrevious
public boolean findPrevious(java.lang.String asExpression, int aiOffset)
- Find the previous occurance of the search expression starting at the specified offset.
findPrevious
public boolean findPrevious(java.lang.String asExpression, int aiOffset, boolean abWrap)
- Find the previous occurance of the search expression starting at the specified offset.
_replaceSelection
private void _replaceSelection(java.lang.String asContent)
- Another implementation of the
replaceSelectionmethod made specifically for theSyntax.
|
|||||||||
| Home >> All >> novaworx >> [ textpane overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC