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

correct way to move a node by dragging in javafx 2?

Here is some code I use to allow a Label to be dragged around in a Pane. I don’t notice any significant lag behind the mouse trail with it. // allow the label to be dragged around. final Delta dragDelta = new Delta(); label.setOnMousePressed(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { // record a … Read more

How to create multiple javafx controllers with different fxml files?

Use FXML as components by using a custom java class as fx:root and as fx:controller of your FXML file: http://docs.oracle.com/javafx/2/fxml_get_started/custom_control.htm To do so, you need to call in the constructor of your custom java class FXMLLoader which will load your FXML. The advantage is to change the way FXML load components. The classic way to … 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

Make portion of a text bold in a JavaFx Label or Text

It is possible to use TextFlow container from JavaFX8. Then you can easily add differently styled Text nodes inside it. TextFlow flow = new TextFlow(); Text text1=new Text(“Some Text”); text1.setStyle(“-fx-font-weight: bold”); Text text2=new Text(“Some Text”); text2.setStyle(“-fx-font-weight: regular”); flow.getChildren().addAll(text1, text2); TextFlow container will automatically wrap content Text nodes.

Javafx 2 click and double click

Yes you can detect single, double even multiple clicks: myNode.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { if(mouseEvent.getButton().equals(MouseButton.PRIMARY)){ if(mouseEvent.getClickCount() == 2){ System.out.println(“Double clicked”); } } } }); MouseButton.PRIMARY is used to determine if the left (commonly) mouse button is triggered the event. Read the api of getClickCount() to conclude that there maybe multiple click … Read more