JavaFX - 如何将ColorPicker添加到我的场景中

时间:2014-07-25 09:20:37

标签: colors javafx color-picker

如何在我的应用程序中添加ColorPicker? 我试过这段代码:

public class MyColorPicker extends Application {

    @Override
    public void start(Stage primaryStage) {
        VBox box = new VBox();
        ColorPicker cp = new ColorPicker();
        box.getChildren().add(cp) // Error: cp Cannot be converted to Node
        Scene scene = new Scene(box, 300, 200);

        primaryStage.setTitle("colorPicker");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

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

0 个答案:

没有答案