本文介绍了如何为JAVAFx中的所有按钮设置默认CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的JAVAfx应用程序中有超过100个按钮,我想为程序中的所有按钮提供一个DEFAULT样式[如下所示]。请帮忙 ! :)
I have over 100 Buttons in my JAVAfx application and I want to give a DEFAULT styling[given below] to all buttons in the programme. Please help ! :)
-fx-background-color:#3c7fb1;
-fx-text-fill: black;
-fx-font-size: 14px;
-fx-padding: 3 30 3 30;
推荐答案
- 创建一个新的CSS文件。
- 将CSS文件附加到
场景
。 - 将按钮样式添加到
.button {}
。
- Create a new CSS file.
- Attach the CSS file to your
Scene
. - Put your button styles to
.button {}
.
这篇关于如何为JAVAFx中的所有按钮设置默认CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!