We are about to switch to a new forum software. Until then we have removed the registration on this forum.
@quark I found another issue today. The following code runs fine:
// Need G4P library
import g4p_controls.*;
public void setup(){
size(480, 320, JAVA2D);
createGUI();
myTextArea.setText("hello world");
}
public void draw(){
background(230);
}
However, if I use too many \n to feed lines, it returns a NullPointerException. Example:
// Need G4P library
import g4p_controls.*;
public void setup(){
size(480, 320, JAVA2D);
createGUI();
myTextArea.setText("\n\n\nhello world");
}
public void draw(){
background(230);
}
Am I doing something wrong? Are there any workarounds? Thank you so much!
Answers
GTextArea cannot have multiple linefeeds and there is no solution or work around.
The GTextArea control is the most complicated of all the G4P controls. When I introduced font-styling I was using Java classes that were never designed to be used directly and the multiple linefeed problem was a consequence.
I found a cheap workaround, by simply including a white space in front of \n
I had forgotten about that. Well done =D>