javafx显示image_如何摆脱JavaFX中的重点突出显示
javafx顯示image
今天,有人問(wèn)我是否知道擺脫JavaFX控件(分別是按鈕)的焦點(diǎn)突出的方法:
有關(guān)此問(wèn)題的大多數(shù)文章和提示建議添加:
.button:focused {-fx-focus-color: transparent; }但是使用這種樣式,仍然會(huì)留下這樣的光芒:
為了擺脫這種光芒,通常還建議另外使用-fx-background-insets :
.button:focused {-fx-focus-color: transparent; -fx-background-insets: -1.4, 0, 1, 2; }但這導(dǎo)致呈現(xiàn)的按鈕沒(méi)有外部邊框:
與默認(rèn)按鈕樣式相比:
這仍然是一種“亮點(diǎn)”。
(為什么實(shí)際上有4個(gè)插入值?)
看一下modena.css定義的JavaFX默認(rèn)樣式,可以modena.css更多信息:
/* A bright blue for the focus indicator of objects. Typically used as the * first color in -fx-background-color for the "focused" pseudo-class. Also * typically used with insets of -1.4 to provide a glowing effect. */ -fx-focus-color: #f25f29; -fx-faint-focus-color: #f25f2933;顯然,不僅有一種焦點(diǎn)顏色-fx-focus-color而且還有-fx-faint-focus-color ,用于創(chuàng)建這種發(fā)光效果(在設(shè)置-fx-focus-color:transparent;時(shí)仍然存在)。
仔細(xì)查看.button:focused偽類(在modena.css ):
.button:focused {-fx-background-color: -fx-faint-focus-color, -fx-focus-color, -fx-inner-border, -fx-body-color; -fx-background-insets: -2, -0.3, 1, 2;-fx-background-radius: 7, 6, 4, 3; }嘗試一些極端的色彩可以揭示這種安排:
.button:focused {-fx-focus-color: red;-fx-faint-focus-color: green;-fx-inner-border: blue;-fx-body-color: orange;-fx-background-color: -fx-faint-focus-color, -fx-focus-color, -fx-inner-border, -fx-body-color; -fx-background-insets: -2, -0.3, 1, 2;-fx-background-radius: 7, 6, 4, 3; }
回到主題,刪除焦點(diǎn)高亮的聰明方法可能是對(duì).button:focus也使用默認(rèn)按鈕樣式(其他控件使用相同的方法):
.button:focused {-fx-background-color: -fx-outer-border, -fx-inner-border, -fx-body-color; -fx-background-insets: 0, 1, 2;-fx-background-radius: 5, 4, 3; }翻譯自: https://www.javacodegeeks.com/2014/11/how-to-get-rid-of-focus-highlighting-in-javafx.html
javafx顯示image
總結(jié)
以上是生活随笔為你收集整理的javafx显示image_如何摆脱JavaFX中的重点突出显示的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 电脑电子琴软件下载(电子琴软件电脑版)
- 下一篇: java日志使用_使用Java 8防止日