|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjhomenet.gui.wizard.BracketMatcher
public class BracketMatcher
A class to support highlighting of parenthesis. To use it, add it as a caret listener to your text component. It listens for the location of the dot. If the character before the dot is a close paren, it finds the matching start paren and highlights both of them. Otherwise it clears the highlighting. This object can be shared among multiple components. It will only highlight one at a time.
| Method Summary | |
|---|---|
void |
caretUpdate(javax.swing.event.CaretEvent e)
Called whenever the caret moves, it updates the highlights |
void |
clearHighlights()
|
static int |
findMatchingParen(javax.swing.text.Document d,
int paren)
Returns the position of the matching parenthesis (bracket, whatever) for the character at paren. |
static char |
getCharAt(javax.swing.text.Document doc,
int p)
Returns the character at position p in the document |
static void |
main(java.lang.String[] a)
A demo main |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public void clearHighlights()
public static char getCharAt(javax.swing.text.Document doc,
int p)
throws javax.swing.text.BadLocationException
javax.swing.text.BadLocationException
public static int findMatchingParen(javax.swing.text.Document d,
int paren)
throws javax.swing.text.BadLocationException
javax.swing.text.BadLocationExceptionpublic void caretUpdate(javax.swing.event.CaretEvent e)
caretUpdate in interface javax.swing.event.CaretListenerpublic static void main(java.lang.String[] a)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||