lexx.gui.editor
Class LexxEditorKit

java.lang.Object
  |
  +--javax.swing.text.EditorKit
        |
        +--javax.swing.text.DefaultEditorKit
              |
              +--javax.swing.text.StyledEditorKit
                    |
                    +--lexx.gui.editor.LexxEditorKit
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

final class LexxEditorKit
extends javax.swing.text.StyledEditorKit

An alternative way to add the DocumentListeners to the editor

Still under development

Idea came from http://www.jguru.com/faq/view.jsp?EID=10832 Yes it's possible. I've developed an editor with lexical/highlighting using ANTLR. You only have to extend the Default EditorKit class and suite it to your needs. In the class used to display the document (usually a class extending PlainView) just call the lexer passing it the text of a text component. Then call nextToken() until you find an EOF. The only problem is that it may be inefficient because each time you scan a portion of text (usually a line) you have to create an InoutStream which contain that text and change the lexer Input State.

Copyright (c) 2002-2003

Since:
25/02/2003
Version:
0.8
Author:
Mohammed Imran

Field Summary
 
Fields inherited from class javax.swing.text.StyledEditorKit
 
Fields inherited from class javax.swing.text.DefaultEditorKit
backwardAction, beepAction, beginAction, beginLineAction, beginParagraphAction, beginWordAction, copyAction, cutAction, defaultKeyTypedAction, deleteNextCharAction, deletePrevCharAction, downAction, endAction, endLineAction, EndOfLineStringProperty, endParagraphAction, endWordAction, forwardAction, insertBreakAction, insertContentAction, insertTabAction, nextWordAction, pageDownAction, pageUpAction, pasteAction, previousWordAction, readOnlyAction, selectAllAction, selectionBackwardAction, selectionBeginAction, selectionBeginLineAction, selectionBeginParagraphAction, selectionBeginWordAction, selectionDownAction, selectionEndAction, selectionEndLineAction, selectionEndParagraphAction, selectionEndWordAction, selectionForwardAction, selectionNextWordAction, selectionPreviousWordAction, selectionUpAction, selectLineAction, selectParagraphAction, selectWordAction, upAction, writableAction
 
Constructor Summary
LexxEditorKit(JavaPackages packages, javax.swing.JTextPane pane)
           
 
Method Summary
 javax.swing.text.Document createDefaultDocument()
           
 java.lang.String getContentType()
          Get the MIME type of the data that this kit represents support for.
 javax.swing.text.ViewFactory getViewFactory()
           
 
Methods inherited from class javax.swing.text.StyledEditorKit
clone, createInputAttributes, deinstall, getActions, getCharacterAttributeRun, getInputAttributes, install
 
Methods inherited from class javax.swing.text.DefaultEditorKit
createCaret, read, read, write, write
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LexxEditorKit

public LexxEditorKit(JavaPackages packages,
                     javax.swing.JTextPane pane)
Method Detail

getContentType

public final java.lang.String getContentType()
Get the MIME type of the data that this kit represents support for. This kit supports the type text/java.

Overrides:
getContentType in class javax.swing.text.DefaultEditorKit

getViewFactory

public final javax.swing.text.ViewFactory getViewFactory()
Overrides:
getViewFactory in class javax.swing.text.StyledEditorKit
Returns:
the view factory

createDefaultDocument

public final javax.swing.text.Document createDefaultDocument()
Overrides:
createDefaultDocument in class javax.swing.text.StyledEditorKit
Returns:
the model