JEditorPane - The Editor Pane Class
This chapter provides tutorial notes and example codes on the editor pane class. Topics include a simple text editor pane; saving text from the editor pane to a file; editing HTML content and Chinese characters in editor pane; using file chooser dialog boxes.
These sections are omitted from this Web preview version. To view the full content,
see information on how to obtain the full version this book.
Creating a Simple Plain Text Editor Pane
Saving Text from an Editor Pane
Editing HTML in an Editor Pane
Editing Unicode Characters in an Editor Pane
javax.swing.JFileChooser - File Chooser Dialog Box
- javax.swing.JEditorPane class can be used to create a simple text editor window.
- setText() and getText() methods can be used to exchange the text content of a JEditorPane window.
- setContentType() method can be used to switch the display mode of a JEditorPane window between text/html and text/plain.
- javax.swing.JFileChooser class can be used to display a dialog box for selecting a file on the local computer.
Sample programs listed in this chapter have been tested with JDK 1.3.1 to JDK 15 on Windows and macOS computers.
Table of Contents
About This Book
JDK (Java Development Kit)
Introduction of Java Swing Package
Graphics Environment of the Local System
JFrame - Main Frame Class
JLabel - Swing Label Class
JButton - Swing Button Class
JCheckBox - Swing Check Box Class
JRadioButton - Swing Radio Button Class
JTextField - Swing Text Field Class
JComboBox - Swing Combo Box Class
Menu Bar, Menus, Menu Items and Listeners
Creating Internal Frames inside the Main Frame
Layout of Components in a Container
LookAndFeel and UIManager
Option Dialog Boxes
►JEditorPane - The Editor Pane Class
SwingWorker - The Background Task Worker
AWT (Abstract Windows Toolkit)
Integration with Desktop System
Full Version in PDF/EPUB