Path: csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail From: Knute Johnson Newsgroups: comp.lang.java.gui Subject: Re: JTextPane.setEditorKit() Date: Fri, 19 Apr 2013 17:00:31 -0700 Organization: A noiseless patient Spider Lines: 28 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 19 Apr 2013 23:57:36 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="aba33539224e5c782fe0c4053f7756fd"; logging-data="11753"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+fXucOteN7mfrUHDQeqcu+" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 In-Reply-To: Cancel-Lock: sha1:Wa5RCLXDmT6/4Qx1TsGSab5OZFI= Xref: csiph.com comp.lang.java.gui:5327 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