Aspirant
Aspirant

Reputation: 1954

JavaFX 2: Color Picker without custom color

Is there a way to render a color picker without the "Custom colors" option?

Or is there a way to disable the "Custom Color" option from the color picker?

Regards

Upvotes: 3

Views: 1715

Answers (3)

Trizion
Trizion

Reputation: 470

To get rid of the hyperlink together with the separator and the excess space that remains when just removing those two:

.color-palette .hyperlink, .color-palette .separator {
    visibility: hidden;
}
.color-palette {
    -fx-padding: 15 15 -30 15;
}

! Note that the style needs to be added to the scene Object to take effect.

Upvotes: 1

DustWing
DustWing

Reputation: 11

Since i was also searching for a simple solution. If you want to use the default color picker you can use this style class:

.color-palette > .hyperlink {
    visibility: hidden ;
}

Upvotes: -1

Travis
Travis

Reputation: 2026

Stumbled on this but haven't tried it, maybe the customizable color picker you're looking for?

https://github.com/fxexperience/code/blob/master/FXExperienceControls/src/com/fxexperience/javafx/scene/control/colorpicker/ColorPickerPopover.java

Upvotes: 2

Related Questions