About JdbEditorPane

Swing's EditorPane lets you view and edit plain text, rich text (RTF format), and HTML. dbSwing's JdbEditorPane makes JEditorPane data-aware: you can store text documents in a column of a data set, load a selected document into a JdbEditorPane by navigating to its row, edit the document, and save it back to the data set. When objects in a column of a data set are displayed in a JdbEditorPane, they should all be the same Swing document type - for example, they might all be DefaultStyledDocuments containing RTF data.

Although it is possible to edit HTML in a JdbEditorPane, the component is mainly intended for viewing. A JdbEditorPane can load an HTML page even when its editable property is set to false. When data-aware, JdbEditorPane can be bound to two columns: one supplies a URL, the other holds the HTML page.

dbSwing also adds a popup menu of common text operations and the ability to insert a new row into a dataset to store an HTML page loaded from a hyperlink, along with its URL. These features are not used in this sample.

Note: Our goal in this application is to use a data set as a cache for HTML pages. However, reloading a cached page involves deserializing a complex serialized object, and Swing is often unable to do this. As a workaround, we've disabled caching by clearing the HTML column whenever a value is saved to it. We still bind our JdbEditorPane to two columns, because we need to use the column containing a URL to load our HTML pages. For this application, performance is acceptable without caching because our help files are small and can be loaded quickly. JdbEditorPane may not be useful for more demanding applications.