Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #30539

Re: JEditorPane question

From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: JEditorPane question
Date 2014-12-11 18:31 +0000
Organization A noiseless patient Spider
Message-ID <m6cnui$3tg$1@dont-email.me> (permalink)
References <m64a5v$d3j$1@dont-email.me> <m659sr$5vl$1@dont-email.me> <m65car$d52$1@dont-email.me> <m65sr8$tdq$1@dont-email.me> <m65trp$l8$1@dont-email.me>

Show all headers | View raw


On Mon, 08 Dec 2014 23:28:59 -0500, Jeff Higgins wrote:

> should be:
> source.getText().substring(p0.getOffset(), p1.getOffset());
>
Thanks for the tutorial in using the TransferHandler class and for the 
correction shown above, but cut and paste still doesn't seem to be 
getting CRLF: without that correction cut and paste seems to be 
duplicating LF, i.e.  the double newline in the middle of your examole 
test becomes LFLFLFLF and with the correction I'm seeing LFLF. In both 
cases the text, when grabbed with getText() and sent to System.out or 
written to a file via the PrintWriter, shows CRLFCRLF.

So, it looks very much as though copying and pasting text with CRLF isn't 
going to be at all easy. I tried adding String.replace() into the last 
line of CreateTransferrable():

	return new StringSelection(data.replace("\n", "\r\n"));

but that merely doubled the number of "\n" symbols output, so I think the 
way to go will be to modify the website to accept both Linux and Windows 
linebreaks.

Thanks for your help: I've learnt quite a lot about this part of Swing.

-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

JEditorPane question Martin Gregorie <martin@address-in-sig.invalid> - 2014-12-08 13:47 +0000
  Re: JEditorPane question Jeff Higgins <jeff@invalid.invalid> - 2014-12-08 17:48 -0500
    Re: JEditorPane question Martin Gregorie <martin@address-in-sig.invalid> - 2014-12-08 23:30 +0000
      Re: JEditorPane question Jeff Higgins <jeff@invalid.invalid> - 2014-12-08 19:14 -0500
        Re: JEditorPane question Jeff Higgins <jeff@invalid.invalid> - 2014-12-08 19:49 -0500
          Re: JEditorPane question Jeff Higgins <jeff@invalid.invalid> - 2014-12-08 20:48 -0500
            Re: JEditorPane question Jeff Higgins <jeff@invalid.invalid> - 2014-12-08 21:21 -0500
              Re: JEditorPane question Jeff Higgins <jeff@invalid.invalid> - 2014-12-08 21:37 -0500
      Re: JEditorPane question Jeff Higgins <jeff@invalid.invalid> - 2014-12-08 23:11 -0500
        Re: JEditorPane question Jeff Higgins <jeff@invalid.invalid> - 2014-12-08 23:28 -0500
          Re: JEditorPane question Martin Gregorie <martin@address-in-sig.invalid> - 2014-12-11 18:31 +0000
        Re: JEditorPane question Martin Gregorie <martin@address-in-sig.invalid> - 2014-12-09 09:41 +0000
        Re: JEditorPane question Jeff Higgins <jeff@invalid.invalid> - 2014-12-09 22:41 -0500
          Re: JEditorPane question Jeff Higgins <jeff@invalid.invalid> - 2014-12-10 00:46 -0500

csiph-web