[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Different treatment of line breaks in TextPanes and TextAreas  XML
Forum Index -> Development
Author Message
ldonker

Active

Joined: 22/07/2015 08:38:25
Messages: 6
Offline

Hello,

we found that TextPanes and TextAreas have da different treatment of line breaks. For example the TextArea don´t recognize "\r" but the TextPane does.

For the Java String:
Code:
 String m_text = "Hi \n dies \r ist ein \r\n Test"; 

There ist the screenshot as attached file.

So, is there a reason for the unequal treatment of the components?
Or have somebody a workaround for this issue?

kind regards
Lukas Donker
 Filename linebreaks.PNG [Disk] Download
 Description Screenshot of "Hi \n dies \r ist ein \r\n Test" TextPane top, Textarea bottom
 Filesize 2 Kbytes
 Downloaded:  353 time(s)

CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5521
Offline

In both conrtols we simply pass the text into the corresponding Swing control - without any further treatment on our side.

So this is the nature of the swing controls.

I am not sure... when does a "\r" happen without "\n" happen in real life? If ti was a difference between "\n" and "\r\n" (as it happnes with simple text editors) then I would feeld we should "rightsize", but with just "\r"...?

Regards, Björn

Björn Müller, CaptainCasa GmbH
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team