如何在JavaFX中禁用选定按钮的悬停效果

huangapple 未分类评论43阅读模式
英文:

How to disable selected button hover in java-fx

问题

我试图使选定的按钮看起来完全像未选定的按钮。我只需能够检查按钮是否被点击。我尝试了几乎所有的方法,但仍然无法实现我想要的效果。现在我有这个CSS。如果按钮被选中,它的下边框会变得比其他按钮更粗。是否有可能摆脱这个问题,以便所有选定按钮的边框大小都相同?

这是它的外观:
如何在JavaFX中禁用选定按钮的悬停效果

英文:

I am trying to make selected button look completely like unselected. All I need is to be able to check whether button was clicked or not. I have tried almost everything but still can't do what I want. Now I have this css. If button is selected its
lower border becomes thicker than others. Is there any possibility to get rid of that, so all the borders of selected button will be the same size?

.button {
    -fx-focus-color: transparent;
}

.button:focused {
    -fx-focus-color: transparent;
    -fx-faint-focus-color: transparent;
}

.button:hover {
    -fx-focus-color: transparent;
    -fx-faint-focus-color: transparent;
}

This is how it looks like
如何在JavaFX中禁用选定按钮的悬停效果

huangapple
  • 本文由 发表于 2020年4月10日 01:19:38
  • 转载请务必保留本文链接:https://java.coder-hub.com/61126679.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定