How to make a button appear to have been clicked or selected? (JavaFX2)

前端 未结 2 1585

When user presses a button in my JavaFX2.2 UI, a dark blue halo appears to show it was clicked. During the course of events, my program may want to \'unclick\' it to show it

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-31 11:48

    From a css stylesheet this command also works. There is no need for a toggle button. Once you press a different button, focus changes to the new one.

    .button:focused{
        -fx-background-color: gray;
    

提交回复
热议问题