O'Reilly logo

Java Swing, 2nd Edition by Brian Cole, James Elliott, Marc Loy, Robert Eckstein, Dave Wood

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Overview of the Editor Kits

The following sections provide an overview of the various editor kits. With minor variations, this information applies to all editor kits.

The EditorKit Class

The EditorKit class is the abstract base class for all editor kits. It has a number of methods that define the model (e.g., createDefaultDocument( )), the view (e.g., getViewFactory( )), the capabilities (getActions( )), and the I/O strategy (read( ) and write( )) for a given type of document content. Figure 23-2 shows the EditorKit class and the many classes and interfaces it interacts with.

EditorKit class diagram

Figure 23-2. EditorKit class diagram

This figure shows several important things about the EditorKit class. First, each EditorKit instance is typically associated with a single JEditorPane (though in some cases, it doesn’t care). The EditorKit defines how to create a default Document as well as how to read and write the Document to a stream. In addition, each EditorKit may define a ViewFactory responsible for creating View objects for each Element in the Document. Finally, the diagram shows that an EditorKit may define a set of Actions that it supports.

The other classes shown in the diagram are the subclasses of EditorKit and AbstractAction. We’ll look at each of these classes, as well as some inner classes not shown on the diagram, throughout this chapter.

Properties

EditorKit defines the properties shown in Table ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required