We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Does displaying an updating text at CP5 textarea is ambiguous? Is there other way to output a text in the display except using text() ? My issue with text is that, changing background is a must. Here's my code..
import controlP5.*;
import processing.serial.*;
String ser;
ControlP5 cp5;
Textarea myTextarea;
Serial port;
PImage bg;
void setup() {
size(800, 480);
bg = loadImage("APSS.png");
port = new Serial(this, Serial.list()[0], 9600);
cp5 = new ControlP5(this);
myTextarea = cp5.addTextarea("txt")
.setPosition(100, 100)
.setSize(200, 200)
.setFont(createFont("arial", 12))
.setLineHeight(14)
.setColor(color(128))
.setColorBackground(color(255, 100))
.setColorForeground(color(255, 100));
;
}
void draw() {
ser = port.readString();
delay(1000);
drawBackground();
}
void drawBackground() {
background(bg);
myTextarea.setText(ser);
}
Answers
What does this code do that is different from what you expect it does?