Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JTextPane.setEditorKit()

67 views
Skip to first unread message

FredK

unread,
Apr 19, 2013, 4:45:09 PM4/19/13
to
Calling setEditorKit()from a JTextPane deletes the current content. I did not find this documented anywhere - should it do this?
--
Fred K

Knute Johnson

unread,
Apr 19, 2013, 8:00:31 PM4/19/13
to
On 4/19/2013 1:45 PM, FredK wrote:
> Calling setEditorKit()from a JTextPane deletes the current content. I
> did not find this documented anywhere - should it do this?
>

I don't think that is unexpected.

public void setEditorKit(EditorKit kit)

Sets the currently installed kit for handling content. This is the bound
property that establishes the content type of the editor. Any old kit is
first deinstalled, then if kit is non-null, the new kit is installed,
and a default document created for it. A PropertyChange event
("editorKit") is always fired when setEditorKit is called.

NOTE: This has the side effect of changing the model, because the
EditorKit is the source of how a particular type of content is modeled.
This method will cause setDocument to be called on behalf of the caller
to ensure integrity of the internal state.

Parameters:
kit - the desired editor behavior
See Also:
getEditorKit()

--

Knute Johnson

Roedy Green

unread,
Apr 20, 2013, 10:55:24 AM4/20/13
to
On Fri, 19 Apr 2013 13:45:09 -0700 (PDT), FredK
<fred.l.kl...@gmail.com> wrote, quoted or indirectly quoted
someone who said :

>Calling setEditorKit()from a JTextPane deletes the current content. I did not find this documented anywhere - should it do this?
The content has a completely different format. What else could it
do?
--
Roedy Green Canadian Mind Products http://mindprod.com
Computer programming is the best remedy for pain (physical or emotional)
I have encountered. It requires so much concentration there is nothing left
over to pay attention to the pain. They should teach this in AA.
0 new messages