AutoCompletionBinding cannot access class com.sun.javafx.event.EventHandlerManager

If you are using ControlsFX 11, add the following VM option to your runtime command line: –add-exports javafx.base/com.sun.javafx.event=org.controlsfx.controls Note: Previous answers (on other sites and also here on SO) have suggested the following: –add-exports javafx.base/com.sun.javafx.event=ALL-UNNAMED However, recent versions of ControlFX appear to be modularized and the modules are no longer unnamed. If you are using … Read more

How to add a value marker to JavaFX chart?

To convert chart values to pixels you can use method NumberAxis#getDisplayPosition() which return actual coordinates of the chart nodes. Although these coordinates are relative to chart area, which you can find out by next code: Node chartArea = chart.lookup(“.chart-plot-background”); Bounds chartAreaBounds = chartArea.localToScene(chartArea.getBoundsInLocal()); Note localToScene() method which allows you to convert any coordinates to Scene … Read more

Line Chart Live update

Based on JewelSea’s example on AnimatedAreaChart, I modified it to make a similar example for you based on LineGraph. Please have a look at the example, hope it satisfies your need! import javafx.animation.AnimationTimer; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.chart.LineChart; import javafx.scene.chart.NumberAxis; import javafx.scene.chart.XYChart; import javafx.stage.Stage; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; public class … Read more

How to use JavaFX MediaPlayer correctly?

The problem is because you are trying to run JavaFX scene graph control outside of JavaFX Application thread. Run all JavaFX scene graph nodes inside the JavaFX application thread. You can start a JavaFX thread by extending JavaFX Application class and overriding the start() method. public class Main extends Application { @Override public void start(Stage … Read more

How to create toolbar with left, center and right sections in javaFX?

Spring method for ToolBar section alignment works fine for me. import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.layout.*; import javafx.stage.Stage; public class SectionalToolbar extends Application { @Override public void start(Stage stage) throws Exception { final Pane leftSpacer = new Pane(); HBox.setHgrow( leftSpacer, Priority.SOMETIMES ); final Pane rightSpacer = new Pane(); HBox.setHgrow( rightSpacer, Priority.SOMETIMES ); final … Read more

JavaFX – setOnAction not applicable

You have imported awt event listener just change this line of code import java.awt.event.ActionEvent; with this import javafx.event.ActionEvent; and you can also use lambda expression like this btn.setOnAction((event) -> { System.out.println(“Button clicked”); });