Processing – Text eingeben

String text1="";

void setup() {
size(100, 100);
background (0);
}

void draw() {
if (text1.equals("abcd")) {
println("Hurra!");
text1 = "";
}
}

void keyPressed() {
if (key==CODED) {
if (keyCode==LEFT) {
println ("left");
}
else {
println ("unknown special key");
}
}
else
{
if (key==BACKSPACE) {
if (text1.length()>0) {
text1=text1.substring(0, text1.length()-1);
}
}
else {
text1+=key;
}
println (text1);
}
}