When you press F1 GTextArea will be cleared, BUT the caret will remain in old position. Than if you try to enter any key StringIndexOutOfBoundsException will be thrown.
import g4p_controls.*;
import java.awt.event.KeyEvent;
GTextArea a;
public void setup() {
size(640, 400);
a = new GTextArea(this, 20, 20, 280, 200);
}
public void draw() {
background(255, 128, 128);
fill(255);
text(a.getText(), 340, 20, 280, 200);
}
void keyPressed() {
if (keyCode == KeyEvent.VK_F1) {
a.setText("");
}
}
Fixed in 4.0.4