创建按钮

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 }

效果

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

 

相关文章:

  • 2022-12-23
  • 2021-09-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-06-21
  • 2021-11-14
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-08-28
  • 2022-02-23
  • 2021-08-15
相关资源
相似解决方案