
Undocumented Secrets of MATLAB
®
-Java Programming388
Note that the text is HTML-encoded if the current content-type and EditorKit are
HTML-based, so replaceSelection(‘<b>123</b>’) will actually insert “<b>
123</b>” instead of the requested HTML code — use setText to solve this prob-
lem.
HTMLEditorKit also contains several methods
56
to insert HTML tags (e.g.,
‘<b>123</b>’) at specic
HTML.Tag
57
locations (e.g., ‘HTML.Tag.Body’) using the
HTMLEditorKit.insertHTML() method and the HTMLEditorKit.InsertHTML-
TextAction
58
inner class.
insertComponent(Component)
◾ — inserts the specied Swing component (button/
table