Maven Shade JavaFX runtime components are missing

UPDATE 10/2021 Since JavaFX 16 a warning is displayed when JavaFX doesn’t run on the module path, which is the case of an uber/fat jar: $ java -jar myFatJar-1.0-SNAPSHOT.jar Oct 02, 2021 1:45:21 PM com.sun.javafx.application.PlatformImpl startup WARNING: Unsupported JavaFX configuration: classes were loaded from ‘unnamed module @14c24f4c’ Also, you get a warning from the shade … Read more

Javafx tableview not showing data in all columns

This question is really a duplicate of: Javafx PropertyValueFactory not populating Tableview, but I’ll specifically address your specific case, so it’s clear. Suggested solution (use a Lambda, not a PropertyValueFactory) Instead of: aColumn.setCellValueFactory(new PropertyValueFactory<Appointment,LocalDate>(“date”)); Write: aColumn.setCellValueFactory(cellData -> cellData.getValue().dateProperty()); For more information, see this answer: Java: setCellValuefactory; Lambda vs. PropertyValueFactory; advantages/disadvantages How do you use a … Read more

JavaFX periodic background task

You can use Timeline for that task: Timeline fiveSecondsWonder = new Timeline( new KeyFrame(Duration.seconds(5), new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { System.out.println(“this is called every 5 seconds on UI thread”); } })); fiveSecondsWonder.setCycleCount(Timeline.INDEFINITE); fiveSecondsWonder.play(); for the background processes (which don’t do anything to the UI) you can use old good java.util.Timer: new Timer().schedule( … Read more

How do I determine the correct path for FXML files, CSS files, Images, and other resources needed by my JavaFX Application?

Short version of answer: Use getClass().getResource(…) or SomeOtherClass.class.getResource(…) to create a URL to the resource Pass either an absolute path (with a leading /) or a relative path (without a leading /) to the getResource(…) method. The path is the package containing the resource, with . replaced with /. Do not use .. in the … Read more

JavaFX Homework [duplicate]

To increase no. of blades dynamically, you need to change no. of arcs you are making, its length and angle difference. Change your constructor of FanPane according to below code. public FanPane(int blade) { circle.setStroke(Color.BLUE); circle.setFill(Color.WHITE); circle.setStrokeWidth(4); getChildren().add(bpane); slider1.setShowTickLabels(true); slider1.setShowTickMarks(true); slider1.setMajorTickUnit(5); slider1.setMinorTickCount(0); slider1.setBlockIncrement(1); slider2.setShowTickLabels(true); slider2.setShowTickMarks(true); slider2.setMajorTickUnit(5); slider2.setMinorTickCount(0); slider2.setBlockIncrement(1); gpane.setConstraints(speed, 0, 0); gpane.setConstraints(slider1, 1, 0); gpane.setConstraints(numBlades, … Read more