EditorPane
Rendered markup: markup is source written in the language contentType names, and the JEditorPane shows what the kit registered for that content type makes of it, so EditorPane("<h1>Report</h1>", { href -> open(href) }, contentType = "text/html") renders a heading rather than the characters that spell one.
The pane renders and does not report: it holds no text the caller does not declare, and the user cannot type into it. To let the user author rich text, drive a pane with a DocumentState through the state overload, which owns the document and reports what is typed into it.
A link the user activates is reported to onLinkActivate as the raw href, and nothing is opened - where the link leads is the caller's to decide. baseUrl is the HTML document's base: what relative references in the source, href and <img src> alike, resolve against, and without one they resolve against nothing. A base reaches only a content type that renders into an HTML document, a kit whose model holds no base having nothing to resolve against in the first place.
Parameters
the source, written in contentType's language, the pane renders
callback invoked with the raw href of a link the user activates
the SwingModifier applied to the underlying component
the MIME type naming the kit that parses and renders markup (a ContentType MIME string); text/plain by default, which shows the source as written
the location relative references in HTML markup resolve against; null by default
See also
the DocumentState-driven overload, for text the user authors
Throws
if no editor kit is registered for contentType.
An EditorPane driven by a raw HyperlinkListener instead of an onLinkActivate lambda. The listener hears every link event the pane publishes - entered and left as well as activated - and reaches the resolved URL and the source element behind each; pass a stable instance (e.g. remember {}) to avoid churn.
Parameters
the source, written in contentType's language, the pane renders
the listener notified of link events
the SwingModifier applied to the underlying component
the MIME type naming the kit that parses and renders markup (a ContentType MIME string); text/plain by default, which shows the source as written
the location relative references in HTML markup resolve against; null by default
See also
the DocumentState-driven overload, for text the user authors
Throws
if no editor kit is registered for contentType.
An EditorPane driven by a DocumentState. The pane renders the state's own document, so text typed into the pane and edits made through the state are the same content, and the caret is kept two-way with DocumentState.selection. The state is the single source of truth; there is no onValueChange.
The pane renders the state's document through the editor kit the state was built with, so markup is rendered rather than shown as the characters that spell it:
EditorPane(state = rememberDocumentState("<h1>Report</h1>", contentType = "text/html"))A state that adopted a document without naming a kit is rendered through the pane's own, plain text.
With editable the pane is Swing's rich-text editor: the user authors the rendered content, and what they write is the state's own text. Hyperlinks in an HTML document are live only while the pane is not editable.
Parameters
the hoistable text state the pane renders and drives.
the SwingModifier applied to the underlying component
whether the user can type into the pane; true by default