JavaFX 学习笔记——jfoenix类库学习——raised风格按钮创建

原文链接: http://www.cnblogs.com/new-moon/p/9675133.html

创建按钮

1 JFXButton jfxb = new JFXButton("hello");

2 jfxb.getStyleClass().add("button-raised"); 

导入css文件

1 scene.getStylesheets().add(Suozailei.class.getResource("/css/jfoenix-components.css").toExternalForm()); // Suozailei是这个文件的类名

css中的关键片段

1 .button-raised {
2     -fx-padding: 0.7em 0.57em;
3     -fx-font-size: 14px;
4     -jfx-button-type: RAISED;
5     /* -fx-background-color: rgb(55, 103, 31);*/
6     -fx-background-color: rgb(0, 139, 139);
7     -fx-pref-width: 200;
8     -fx-text-fill: WHITE;
9 }

效果

 

转载于:https://www.cnblogs.com/new-moon/p/9675133.html

你可能感兴趣的:(JavaFX 学习笔记——jfoenix类库学习——raised风格按钮创建)