Hello folks!
I can run JavaFX code examples (links below) with:
- Windows 10 Pro 22H2
- Processing 4.3.2
Steps:
- Install the JavaFX library.
- Import the JavaFX library in your code:
-
Add the JavaFX modules (jar files in modules folder) to your sketch folder.
I have some code below to assist with finding them.
The simplest way to do this is to drag and drop them into your sketch window.
This will create a folder called code that contains them.
Or…
You cold also manually create a folder called code and copy the JavaFX modules into this. -
I suggest you create a code template that contains these JavaFX modules for future use!
You then “Save as” a new sketch to use in future.
I am able to run these examples from the forum with steps provided in this post for W10 and Processing 4.3.2:
- Multiplication Table for JavaFX
- JavaFX WebView Preview
- JavaFX Controls Preview
- There may be more… do a search!
Code to assist with finding the JavaFX modules folder:
// Assist with finding JavaFX modules and open folder
// Opens the folder on a Windows 10 system
// Author: glv
// Date: 2025-02-04
// Insight gleaned from various sources; seek and you shall find.
// Note:
// It only works with a new sketch name starting with "sketch" !
// You MUST save the sketch folder first !
// If you don't save it it points the %temp% directory.
import java.awt.Desktop;
import java.io.File;
import java.io.IOException;
void setup()
{
String sp = sketchPath("");
println(sp);
String path = sp.substring(0, sp.indexOf("\\sketch"));
println(path);
path = path + "\\libraries\\javafx\\library\\windows-amd64\\modules";
println();
println("This is where the JavaFX modules are:");
println(path);
// Specify the path of the folder you want to open
File folder = new File(path);
if (folder.exists() && folder.isDirectory())
{
try
{
Desktop.getDesktop().open(folder);
}
catch (IOException e)
{
e.printStackTrace();
}
}
else
{
System.out.println("The specified folder does not exist or is not a directory.");
}
}
Output:
Opens this folder on my system:
I encourage you to explore the references below to help understand and navigate this.
There are some menu items in the Processing PDE to explore that are very useful!
Additional references:
And there is main Processing website!
Have fun!
:)