I am able to add Text, Rectangle, Circle to a JavaFX window in version 4.0.1, but fail when it comes to adding a Button control. Error msg is shown below. Does anyone know how to fix this?
import processing.javafx.*; // Add this for Processing 4:
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
void setup() {
size(1, 1, FX2D);
surface.setVisible(false); // Don't show default Processing window
Stage stage = new Stage();
stage.setTitle("Button demo");
Button btn = new Button("button");
StackPane pane = new StackPane();
pane.getChildren().add(btn);
Scene scene = new Scene(pane, 400, 400);
stage.setScene(scene);
stage.show();
}
void draw() {
}