当您正常添加ColorPicker
时,会得到一个小箭头,当您点击它时,将显示实际的ColorPicker
窗口。有没有什么办法可以让这个窗口始终可见,而不必点击那个箭头?
我想将ColorPalette
和CustomColorDialog
直接添加到主应用程序中,而不必打开新窗口或单击按钮以便能够看到这些对话框。
答案 0 :(得分:0)
您可能需要查看 CustomColorDialog 和 ColorPalette 。
ColorPalette 是单击箭头时弹出的对话框
CustomColorDialog 是单击"自定义颜色"时显示的窗口。在 ColorPallete 中。 CustomColorDialog 的小例子:
Button buttonShowColorPicker = new Button( "Show custom color dialog!" );
buttonShowColorPicker.setOnAction( actionEvent -> {
CustomColorDialog customColorDialog = new CustomColorDialog( stage );
customColorDialog.show();
} );
Scene scene = new Scene( new StackPane( buttonShowColorPicker ) );
stage.setScene( scene );
stage.show();