We are about to switch to a new forum software. Until then we have removed the registration on this forum.
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
What error does it display when run in 3.1.1?
"The function "add(Label)" does not exist" & "The function "add(TextField)" does not exist"
v2 PApplet extended Applet and those methods are methods on Applet
http://grepcode.com/file/repo1.maven.org/maven2/org.processing/core/2.2.1/processing/core/PApplet.java (warning, slow)
v3 PApple doesn't extend Applet so you lose those methods (which are java awt components)
https://github.com/processing/processing/blob/master/core/src/processing/core/PApplet.java
but there may be new / other ways of changing the window title (if that's what you're doing)
Actually I was looking for an easy way to create text inputs fields. I don't like the G4P GUI...
there are 3 other libraries in the 'gui' section here. but i have no direct experience of any of them.
https://processing.org/reference/libraries/