使JavaFX ColorPicker始终可见

时间:2017-07-20 06:56:48

标签: java javafx color-picker

当您正常添加ColorPicker时,会得到一个小箭头,当您点击它时,将显示实际的ColorPicker窗口。有没有什么办法可以让这个窗口始终可见,而不必点击那个箭头?

我想将ColorPaletteCustomColorDialog直接添加到主应用程序中,而不必打开新窗口或单击按钮以便能够看到这些对话框。

1 个答案:

答案 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();