Skip to main content

NewLine in JavaFX

6 replies [Last post]
peshkatari
Offline
Joined: 2008-04-17

Hi, im trying to put a new line character into a String but it seems that the compiler has a problem with it. it just removes the \n or the \t char.
What i was trying:
var t = Text {
content: "Hello \nWorld"
}

or
var t = Text {
content: "Hello
World"
}

neither of them worked. i was wondering if there is a {__NEWLINE__} symbol.
Thanks in advance

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
peshkatari
Offline
Joined: 2008-04-17

The only problem is that there is no TextArea suported for the Compiler. the whole package has been deleted and replaced with brand new elements in the javafx.gui.*
iv tried it with both Text and Label and it doesnt work. And with the interpreter they all work.
Thanks anyway.
Some new ideas???? This cant be a feature i hope...

alexsch
Offline
Joined: 2007-07-12

I have filled an issue on it:
JFXC-1333 NewLine does not work for Text components
http://openjfx.java.sun.com/jira/browse/JFXC-1333

peshkatari
Offline
Joined: 2008-04-17

Thanks. I hope they are gonna come out with a new Class cuz in the doc it was written that this is the intended effect which means that this Class has a single line string. Sombody should do smth for it since there are no other possibilities to write smth long in FX.

Message was edited by: peshkatari

ahhughes
Offline
Joined: 2008-02-25

It's now October and I'm experiencing the same behavior and I am using 'preview1'. I can't see that jira issue even if I create an account. Pretty concerning if you can't put a newline character into a string. Hopefully someone can clear this up.....

michael_heinrichs
Offline
Joined: 2007-11-15

As mentioned above, the component was meant for single-line strings only. Don't worry, this will be fixed in the final release.

shagus
Offline
Joined: 2007-05-10

Hi, the new-line char \n is working fine for TextArea.

import javafx.ui.*;
Frame {
var t = TextArea {
text: "Hello \nWorld"
}
content: t
visible:true
}