How can i Change the DOt in a JavaFx RadioButton?


Question

Hello Stackeroverflowers,

i'd like to ask how can i change a RadioButton Dot? I need to define 3 RadioButtons with 3 different Colors to show a state. Do i have to work with Css? Would be perfect if anyone could tell me how can i realize that ?

A Example would be:

@FXML
public RadioButton redState = new RadioButton();
.
.
.
redState.setDotColor(red);

or in Fxml to define the Color static:

style="-fx-dot-color: rgb(255,0,0);" 

I hope everyone understood my Plan. It's only about colorize the Dot in a javafx RadioButton.

I'm thankfull for every Answer.

1
5
7/2/2014 12:18:53 PM

Accepted Answer

I haven't tested this, but try

redState.getStyleClass().add("red-radio-button");

(or do this in FXML if you prefer).

And then in an external css file

.red-radio-button .dot {
  -fx-mark-highlight-color: red ;
  -fx-mark-color: red ;
}
7
7/2/2014 3:05:52 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon