5

I'm new to working with javaFX and recently ran into the following error when running the application through Eclipse. My code:

import javafx.scene.Scene;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;

public class WindowBetaV02 extends AbstractWindow{

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

    public void start(Stage mainStage){
        height = 480;
        width = 640;
        mainStage = new Stage();
        mainStage.setTitle("AMQ");
        mainStage.setScene(drawGUIGameNormal());
        mainStage.setResizable(false);
        mainStage.show();
    }

    private Scene drawGUIGameNormal(){
        //Draw gui
    }
}

import javafx.application.Application;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.ColumnConstraints;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.RowConstraints;
import javafx.stage.Stage;

public abstract class AbstractWindow extends Application {
    protected int height;
    protected int width;
    protected GameFunctions controller;

    public abstract void start(Stage stage);

    protected GridPane createPlayerPane(int width, int height){
        GridPane playerPane = createPixelGridPane(width, height);
        playerPane.getStyleClass().add("playerPane");       
        playerPane.add(createPlayerTable(), 10, 10, width-10, width-10);
        return playerPane;
    }

    @SuppressWarnings({ "rawtypes", "unchecked" })
    protected TableView createPlayerTable(){
        TableView table = new TableView();
        TableColumn points = new TableColumn("Points");
        points.setMaxWidth(30);
        points.setMinWidth(30);
        points.setCellFactory(new PropertyValueFactory<Players, Integer>("points"));

        TableColumn player = new TableColumn("Player");
        player.setMaxWidth(100);
        player.setMinWidth(100);
        player.setCellFactory(new PropertyValueFactory<Players, String>("playerName")); 

        table.setItems(controller.getPlayers());
        table.getColumns().addAll(player, points);

        return table;
    }

    protected GridPane createPixelGridPane(int width, int height){
        GridPane pane = new GridPane();
        for(int i = 0; i < width; i++){
            pane.getColumnConstraints().add(new ColumnConstraints(1));
        }
        for(int i = 0; i < height; i++){
            pane.getRowConstraints().add(new RowConstraints(1));
        }
        return pane;
    }
}

The error

Exception in thread "main" java.lang.RuntimeException: Application launch error
    at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:122)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsatisfiedLinkError: com.sun.glass.ui.win.WinApplication._invokeLater(Ljava/lang/Runnable;)V
    at com.sun.glass.ui.win.WinApplication._invokeLater(Native Method)
    at com.sun.glass.ui.Application.invokeLater(Application.java:338)
    at com.sun.javafx.tk.quantum.QuantumToolkit.defer(QuantumToolkit.java:620)
    at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:173)
    at com.sun.javafx.application.PlatformImpl.runAndWait(PlatformImpl.java:212)
    at com.sun.javafx.application.PlatformImpl.tkExit(PlatformImpl.java:320)
    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:421)
    at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:47)
    at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
    ... 1 more

Anyone know how to fix this error?

-Edit-

Added the code for the AbstractWindow class

1 Answer 1

3

You are in JavaFx, your Main class have to extends Application and not Window

Sign up to request clarification or add additional context in comments.

1 Comment

Window was actually an abstract class I've created that extends Application, I have renamed it to AbstractWindow to reflect that, but the problem still persist

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.