Text Fields

On the internet I found the following sketch which works perfectly on processing 2.2.1 but not on 3.1.1. Why is that and how can I make it run?

import java.awt.*;

Label textFieldLabel = new Label("Titel des Fensters: ");
TextField textField = new TextField("Ein Fenster", 16);

void setup(){
  size(800, 600);
  add(textFieldLabel);
  add(textField);
}

void draw(){
  frame.setTitle(textField.getText());
}

Answers

Sign In or Register to comment.