Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove text from colour picker

The JavaFX colour picker is rather neat, but it always seems to display the text representation of the colour, as well as the colour itself:

JavaFX colour dialog with text

I'd like it without the text, just with the colour square, but can't seem to find a method to style it this way. The only thing that's come close I've tried so far is to restrict the width of the control so the text can't be shown:

picker.setMaxWidth(30);

...but that seems incredibly hacky, and still produces a "..." to the side of the button where the text has been trimmed off:

enter image description here

Any ideas?

like image 436
Michael Berry Avatar asked Jan 20 '14 23:01

Michael Berry


1 Answers

Try

colorpicker.setStyle("-fx-color-label-visible: false ;");

like image 98
James_D Avatar answered Oct 31 '22 03:10

James_D