0

Hi I started a JavaFx course and i copied code from course to try it on my own but to my suprise everything is not working at all. At first intelij didn't recognized any of JavaFx packages so i added it guided by this https://openjfx.io/openjfx-docs/ . Still nothing showed up. There is the code:

package sample;

import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.FlowPane;
import javafx.stage.Stage;

public class Main extends Application {
private Label myLabel;

private TextField nameTextField;


public void start(Stage primaryStage) throws Exception{
    primaryStage.setTitle("Hello JavaFX");

    Button button = new Button();
    button.setText("Click Me!");

    myLabel = new Label();
    nameTextField = new TextField();

    myLabel.setText("This is my label");

    FlowPane flowPaneRoot = new FlowPane(10, 10);
    flowPaneRoot.setAlignment(Pos.CENTER);



    flowPaneRoot.getChildren().add(button);
    flowPaneRoot.getChildren().add(myLabel);

    Scene scene =
            new Scene(flowPaneRoot, 250, 200);
    primaryStage.setScene(scene);
    primaryStage.show();

}

public static void main(String[] args) {
    launch(args);
 }
}

There is error list that i receive: https://pastebin.com/s44d61zE

litseba
  • 7
  • 4
  • If you follow carefully the instructions at https://openjfx.io/openjfx-docs/#IDE-Intellij (first section covers non-modular projects on your IDE without build tools like maven/gradle), you should be able to make it run. Your exception shows that you are not adding `--add-modules javafx.controls` to the VM options. – José Pereda Apr 12 '19 at 22:38
  • I added those modules to the VM option and I got error that module javafx.base is not found so also added it to the VM and still same error Edit. I'm retarted and i forgot to paste path to JavaFx SDK – litseba Apr 12 '19 at 23:48

0 Answers0