7

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.

Artur Rem
  • 209
  • 1
  • 4
  • 18

1 Answers1

8

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 ;
}
James_D
  • 201,275
  • 16
  • 291
  • 322