You can do the following code in .css file
(您可以在.css文件中执行以下代码)
.button
{
-fx-background-color: transparent;
}
This will make the color of button as the color of your application's background color(due to transparency).
(这将使按钮的颜色成为应用程序背景颜色的颜色(由于透明)。)
Furthermore you may also apply some effects to make your button looks more cool.
(此外,您还可以应用一些效果以使按钮看起来更酷。)
To add effects (添加效果)
.button:hover
{
-fx-background-color: yellow;
}
.button:pressed
{
-fx-background-color: brown;
}
At the end ,you may attach the case file with your file(suppose index.java file in which you want to apply css) by writing following code in your index.java
(最后,可以通过在index.java中编写以下代码,将案例文件附加到文件(假设要在其中应用css的index.java文件)中)
scene.getStylesheets().add(getClass().getClassLoader().getResource("application.css").toExternalForm());
Where application.css is the css file with whole css code given above .
(其中application.css是上面提供了完整CSS代码的CSS文件。)
This application file must be present in your src folder. (此应用程序文件必须存在于src文件夹中。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…