|
|
Using Swing Components |
JEditorPaneThe first thing most people want to know is: What's the difference between an editor pane and a text pane? First this section attempt answers that question. Next, this section describes the code in the
TextSamplerDemospecific toJTextPane.Each of these editor kits has been registered with the
JEditorPaneclass and associated with the text format that the kit understands. When a file is loaded into an editor pane, the pane checks the format of the file against its registered kits. If a registered kit is found that supports that file format, the pane uses the kit to read the file, display, and edit it. Thus, the editor pane effectively morphs itself into an editor for that text format.You can extend
JEditorPaneto support your own text format by creating an editor kit for it, and then usingJEditorPane'sregisterEditorKitForContentTypeto associate your kit with your text format.
|
|
Using Swing Components |