How can i Change the DOt in a JavaFx RadioButton?
Asked Answered
M

1

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.

Microdont answered 2/7, 2014 at 12:18 Comment(0)
S
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 ;
}
Semeiology answered 2/7, 2014 at 15:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.