Error invoking method, failed to launch jvm

I ran into the same problem; the following worked for me and helped me make sense of those blasted “Error invoking method.” and “Failed to launch JVM” dialogs: Find your .jar file It has the same name as your Project and it’s in your application’s installation directory under AppData\Local\{ApplicationTitle}\app (shortcut: type %appdata% into explorer); if … Read more

Styling default JavaFX Dialogs

You can style your dialogs with your own css file, but for that you need to take into consideration that the dialog is in fact a new stage, with a new scene, and the root node is a DialogPane instance. So once you create some dialog instance: @Override public void start(Stage primaryStage) { Alert alert … Read more

Using JavaFX controller without FXML

Your question isn’t particularly clear to me: you just create the classes and basically tie everything together with listeners. I don’t know if this helps, but here is a simple example that just has a couple of text fields and a label displaying their sum. This is what I regard as “classical MVC”: the view … Read more

javafx 8 compatibility issues – FXML static fields or methods

It sounds like you are trying to inject a TextField into a static field. Something like @FXML private static TextField myTextField ; This apparently worked in JavaFX 2.2. It doesn’t work in JavaFX 8. Since no official documentation ever supported this use, it’s doesn’t really violate backward compatibility, though in fairness the documentation on exactly … 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 draw image rotated on JavaFX Canvas?

Here is a sample, following similar principles to Katona’s answer, only difference is that it rotates images about arbitrary pivot points by applying a custom transform. import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.canvas.*; import javafx.scene.image.Image; import javafx.scene.layout.StackPane; import javafx.scene.paint.Color; import javafx.scene.transform.Rotate; import javafx.stage.Stage; /** Rotates images round pivot points and places them in a … Read more

JavaFx 8: open a link in a browser without reference to Application

Solution 1: Pass a reference to the HostServices down through your application. This is probably similar to the “quite painful” approach you are anticipating. But basically you would do something like: public void start(Stage primaryStage) throws Exception { FXMLLoader loader = new FXMLLoader(getClass().getResource(“main.fxml”)); Parent root = loader.load(); MainController controller = loader.getController(); controller.setHostServices(getHostServices()); primaryStage.setScene(new Scene(root)); primaryStage.show(); … Read more