Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Jeff Higgins Newsgroups: comp.lang.java.programmer Subject: Re: JEditorPane question Date: Mon, 08 Dec 2014 17:48:13 -0500 Organization: A noiseless patient Spider Lines: 35 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 8 Dec 2014 22:48:59 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="c50a9e5d554cfaba13eda1c71e805135"; logging-data="6133"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX189BEcG+0QH2sIMgtFPOOvc4CVgZeIVY0A=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.2.0 In-Reply-To: Cancel-Lock: sha1:WZFS64Y/FYISGmrtKZ7uVHw7kqA= Xref: csiph.com comp.lang.java.programmer:30514 On 12/08/2014 08:47 AM, Martin Gregorie wrote: > Just a quicky: is there any way to force the newline symbol that > JEditorPane outputs the the display to take a value that isn't native for > the OS the application is running on? > > Why I'm asking: I need to pass data from a Linux system to Windows-based > website by copy & paste between a JEditorPane in my Java application and > an input area on a web page. The web application is expecting CRLF > newlines. My application uses String.replace() to convert newlines to > CRLF before the string is passed to the JEditorPane via its setText() > method. However, when I copy the displayed text from the screen it always > has the Linux LF linebreak in it rather than the CRLF. Just a WAG. Have you looked at TransferHandler et al. > > According to the class description that the DefaultEditorKit sets itself > up to use the first linebreak when data is loaded into it. There are > hints in the description that the EndOfLineStringProperty can be changed, > but as its declared final, this is never going to work. There seems to be a hint that the EndOfLineStringProperty may be changed using the get and put Property methods. There also seems to be a statement that despite in/out test that newlines are always stored internally as \n. > > So, my question: does anybody know how to change the linebreaks used by > the editor after its been started and, particularly, if its possible to > change the linebreak symbol used in the JEditorPane's on screen display > area? > > Sorry I can't be more helpful.