日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > java >内容正文

java

javafx显示image_如何摆脱JavaFX中的重点突出显示

發(fā)布時間:2023/12/3 java 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 javafx显示image_如何摆脱JavaFX中的重点突出显示 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

javafx顯示image

今天,有人問我是否知道擺脫JavaFX控件(分別是按鈕)的焦點突出的方法:



有關(guān)此問題的大多數(shù)文章和提示建議添加:

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

但是使用這種樣式,仍然會留下這樣的光芒:

為了擺脫這種光芒,通常還建議另外使用-fx-background-insets :

.button:focused {-fx-focus-color: transparent; -fx-background-insets: -1.4, 0, 1, 2; }

但這導致呈現(xiàn)的按鈕沒有外部邊框:

與默認按鈕樣式相比:

這仍然是一種“亮點”。

(為什么實際上有4個插入值?)

看一下modena.css定義的JavaFX默認樣式,可以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;

顯然,不僅有一種焦點顏色-fx-focus-color而且還有-fx-faint-focus-color ,用于創(chuàng)建這種發(fā)光效果(在設(shè)置-fx-focus-color:transparent;時仍然存在)。

仔細查看.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; }


回到主題,刪除焦點高亮的聰明方法可能是對.button:focus也使用默認按鈕樣式(其他控件使用相同的方法):

.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中的重点突出显示的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。