The Java FX application does not show anything

0

I'm starting with JavaFX, I have the following code

public class JavaFx1 extends Application {

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("JavaFX Welcome");

    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));
    Scene scene = new Scene(grid, 300, 275);

    Text scenetitle = new Text("Welcome");
    scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
    grid.add(scenetitle, 0, 0, 2, 1);

    Label userName = new Label("User Name:");
    grid.add(userName, 0, 1);

    TextField userTextField = new TextField();
    grid.add(userTextField, 1, 1);

    Label pw = new Label("Password:");
    grid.add(pw, 0, 2);

    PasswordField pwBox = new PasswordField();
    grid.add(pwBox, 1, 2);

    Button btn = new Button("Sign in");
    HBox hbBtn = new HBox(10);
    hbBtn.setAlignment(Pos.BOTTOM_RIGHT);
    hbBtn.getChildren().add(btn);
    grid.add(hbBtn, 1, 4);

    final Text actiontarget = new Text();
    grid.add(actiontarget, 1, 6);

    btn.setOnAction((ActionEvent e) -> {
        actiontarget
                .setFill(Color.FIREBRICK);
        actiontarget.setText("Sign in button pressed");
    });

    primaryStage.setScene(scene);
    primaryStage.show();
}

/**
 * @param args the command line arguments
 */
public static void main(String[] args) {
    launch(args);
}

}

The problem is that when I run it (it compiles with a Gtk-Message: Failed to load module message "pantheon-filechooser-module") and when it executes, it does not show me anything. I'm using Linux Elementary OS.

    
asked by bruno Diaz martin 02.02.2018 в 12:27
source

0 answers