How to make a RadioButton look like regular Button in JavaFX

后端 未结 4 2165
耶瑟儿~
耶瑟儿~ 2020-12-18 07:04

I\'m implementing a toolbox-like pane, so user can only pick one tool at a time, and I switched from Button to RadioButton for its behavior.

<
4条回答
  •  轮回少年
    2020-12-18 07:47

    Here is the style you can use to get rid of the dot

    .radio-button > .radio {
      -fx-background-color: transparent;
      -fx-background-insets: 0;
      -fx-background-radius: 0px;
      -fx-padding: 0.0em; /* 4 8 4 8 */
    }
    .radio-button:selected > .radio > .dot {
      -fx-background-color: transparent;
    }
    

    Documenting here; in case someone finds it useful.

提交回复
热议问题