Editor Kits and Text Actions

  • EditorKits allow developers to put classes for Documents, views, actions and I/O together as a central resource for a given document type.
  • The EditorKit Class contains several methods to define a DefaultDocument.
    • createDefaultDocument() -  creates an empty document for this type
    • getViewFactory() - gets the views
    • getActions() - returns a list of actions that are supported by this document type (eg. cut, copy, paste, select all, etc.)
    • read() and write() - I/O routines that are specific for this document
  • Some EditorKits:
    • DefaultEditorKit() - provides plain text support,
      • copying and pasting data
      • I/O for plain text documents (This is what we'll use)
    • StyledEditorKit()
      • Extension of the DefaultEditorKit
      • Contains actions for setting font family, size, etc, and text alignment
    • HTMLEditorKit
      • Support for HTML documents
      • I/O routines create the actual HTML code. (Document structure kept in Elements until saved)
    • RTFEditorKit
      • Knows how to read Rich Text Documents

Frames and InternalFrames >>