Skip to content

Tag: javafx

How to set pane colour from colour picker

I have some code, in javafx, that has a pane that works like a paint canvas. I need to be able to fill the background color of the pane from a color picker. Currently I have a Color variable that gets the color chosen from the color picker and I try to set it to my Pane (named canvas) as

Build and deploy JavaFX Applicationn with jlink

I have a script build.gradle, which created the IDEA development environment when creating a JavaFX project with Gradle support: After the “build” task is completed, the “distributions” folder appears in the build folder. It contains a zip archive with the following contents: The bin folder contains two scripts, sh and bat. The lib folder contains, as I understand it, all

How to access a variable from one class controller file to another in JavaFX?

So I have an integer number called “size” saved to a controller class called and I want that variable to be accessed through my other controller class file called but I can’t seem to find out how. Answer If a method needs data to perform its functionality, then that data should be a parameter to the

How to set order for dynamically added JavaFX components?

I have a button that generates another button each time it’s clicked. 1 of the problems is, that the generated button is placed in the wrong location. The buttons should start around the Top Left side of the window, but the location of the buttons is at the bottom left of the window. I can’t use the function setAlignment(Pos.TOP_LEFT) to

JavaFX event on Mouse Wheel Finished for ScrollPane

I have a ScrollPane with lots of elements on it, (Same one as this JavaFX setHgrow / binding property expanding infinitely) and initially I was planning on using the setOnScrollFinished(this::scrollFinished); event, however I’ve now discovered through research that this only applies to touch gestures, and trying to find a compromise for the MouseWheel hasn’t been great and I just find