Possibly a dumb question but I can’t seem to figure it out on my own. Hopefully someone here can help me out.
Below is a simple code that works fine in Processing 3. Basically it just imports a JavaFX class. In Processing 4, JavaFX was moved to a separate library but even after installing this library I’m getting this error: The package “javafx” does not exist. You might be missing a library..
Anything I need to do besides installing the JavaFX library in Processing 4? It seems to have the JavaFX JAR files inside javafx/library/windows-amd64/modules but I still get the error above.
Thanks
import javafx.beans.property.SimpleIntegerProperty;
void setup() {
SimpleIntegerProperty version = new SimpleIntegerProperty(1);
}
void draw() {
background(0);
}
I have only used the FX2D renderer in size() and can’t add more to this topic.
I did some testing and this works with Processing 3.5.4 but not with Processing 4.0b8:
// Add this for Processing 4:
//import processing.javafx.*;
// Code from example here:
// https://www.geeksforgeeks.org/javafx-button-with-examples/
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
void setup()
{
size(640, 480, FX2D);
background(209);
stroke(255);
Stage s = new Stage();
s.setTitle("creating buttons");
// create a button
Button b = new Button("button");
// create a stack pane
StackPane r = new StackPane();
// add button
r.getChildren().add(b);
// create a scene
Scene sc = new Scene(r, 200, 200);
// set the scene
s.setScene(sc);
s.show();
}
void draw()
{
}
The proposed solution (not implemented yet) is for the JAR files in the modules subfolder of javafx library to become available to be imported and used in Processing code. That should make it possible to import any javafx classes.