如何使用JavaFX CSS创建类似于Android TextField的JavaFX TextField?
例如 :
我已经尝试了很多FX CSS,但是没有达到这样的效果。此处http://jsfiddle.net/QKm37/用于HTML输入类型的CSS存在,但不适用于JavaFX SceneBuilder。
例如 : /** Not Exist in JavaFX **/
-fx-border: none;
-fx-background: bottom left linear-gradient(#a9a9a9, #a9a9a9) no-repeat, bottom center linear-gradient(#a9a9a9, #a9a9a9) repeat-x, bottom right linear-gradient(#a9a9a9, #a9a9a9) no-repeat;
在您的CSS文件中尝试以下操作:
.text-field {
-fx-background-color: #a9a9a9 , white , white;
-fx-background-insets: 0 -1 -1 -1, 0 0 0 0, 0 -1 3 -1;
}
.text-field:focused {
-fx-background-color: #a9a9a9 , white , white;
-fx-background-insets: 0 -1 -1 -1, 0 0 0 0, 0 -1 3 -1;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句