2. USING JTEXTPANE

Java > Core SWING advanced programming > 4. JEDITORPANE AND THE SWING HTML PACKAGE > Summary

 

Summary

This long chapter examined in great detail the most powerful of the Swing text controls. You saw that, without too much work, you can treat JEditorPane as an out-of-the-box editor for various types of document including HTML and RTF. The power and flexibility of JEditorPane comes from the way in which it exploits the Swing text component architecture, which cleanly separates the tasks of holding the document content, the attributes used to control the way in which it is displayed, the editor kit that controls how the user can interact with the document, and the View objects that determine how the document is actually rendered on the screen. We've looked at each of these pieces in their own right in earlier chapters of this book and in this chapter you saw exactly how JEditorPane uses the text architecture to store and display HTML and how you can leverage this support to parse and manipulate HTML documents without directly involving JEditorPane and without having to display the document to the user. Finally, you saw how to programmatically change the HTML once it has been loaded into the JEditorPane's Document model and how to extend the HTML editor kit to include more actions that can be used to extend its editing capabilities. Using these techniques, you can write code to create and modify HTML documents on-the-fly or turn the basic JEditorPane into a more complete HTML editor.

 

 



Core Swing
Core Swing: Advanced Programming
ISBN: 0130832928
EAN: 2147483647
Year: 1999
Pages: 55
Authors: Kim Topley

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net