Beginner here with JavaFX. I'm working on a Java project with JavaFX and it works completely fine on Eclipse. When I use Visual Studio Code on the other hand, I get errors that look like this:
FridgeGUI.java:1: error: package javafx.application does not exist
import javafx.application.Application;
For me, I prefer Visual Studio Code for the ease of use, but I cannot find what is wrong with it. I believe I added JavaFX correctly using Referenced Libraries. Does anyone know why?
Code:
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class FridgeGUI extends Application {
Button button;
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
primaryStage.setTitle("Fill Up the Fridge!");
button = new Button("Enter");
StackPane layout = new StackPane();
layout.getChildren().add(button);
Scene scene = new Scene(layout, 700, 700);
primaryStage.setScene(scene);
primaryStage.show();
}
}