Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i Change the DOt in a JavaFx RadioButton?

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.

like image 667
Artur Rem Avatar asked Jul 02 '14 12:07

Artur Rem


1 Answers

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 ;
}
like image 73
James_D Avatar answered Sep 21 '22 17:09

James_D