为什么 Intellij 不允许我使用 VBox class?

Why is Intellij not allowing me to use VBox class?

在我的 Intellij IDEA 中,我收到一条错误消息“无法解析符号 'VBox'”。我已经清楚地导入了 VBox:

import javafx.scene.layout.VBox

有解决办法吗?我当前的代码如下:

package sample;

import javafx.application.Application;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.layout.VBox;
import javafx.stage.*;

public class Main extends Application {
    Scene scene1, scene2;
    Stage window;

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

    @Override
    public void start(Stage primaryStage) {
        Label label1 = new Label("This is scene one!");
        Button button1 = new Button("Go to scene two!");
        button1.setOnAction(event -> window.setScene(scene2));

        Vbox layout1 = new VBox(20);
        layout1.getChildren().addAll(label1, button1);
    }
}

错误:Vbox layout1 = new VBox(20);

正确:VBox layout1 = new VBox(20);

它叫VBox,不是Vbox。 Upper/lowercase 在编程中很重要。