如何在我的应用程序中添加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);
}
}