Chapter 23. Editor Panes and Editor Kits
Over the last four chapters we’ve covered just about all the
classes and interfaces that make up the Swing text framework. In this
chapter, we’ll look at a class that ties everything together: EditorKit
. An EditorKit
pulls together the document model,
document view, document editing actions, and document I/O strategy,
serving as a central reference point for a given document type.
In addition to looking at EditorKit
and its subclasses, this chapter
introduces the TextAction
class (an
abstract extension of AbstractAction
)
and the many useful concrete action classes available as inner classes of
the EditorKit
subclasses. These actions
include basic functions such as copying and pasting text as well as
style-oriented tasks such as changing font characteristics.
Throughout the chapter, we build simple but powerful editors for working with increasingly complex content types, moving from plain text to styled text to HTML. Finally, we discuss the process for creating your own editor kit.
Get Java Swing, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.