JFoenix提供的按钮组件为JFXButton,JFXButton提供了两种按钮形式:FLAT、RAISED,默认是 FLAT。
首先,先看一组按钮效果:
对应源码如下:
<JFXButton layoutX="50" layoutY="40" prefWidth="200" prefHeight="50" buttonType="FLAT" text="FLAT 按钮 无底色" style="-fx-font-size: 14px;"/>
<JFXButton layoutX="300" layoutY="40" prefWidth="200" prefHeight="50" buttonType="FLAT" text="FLAT 按钮 有底色" style="-fx-font-size: 14px; -fx-background-color: #F4A460;"/>
<JFXButton layoutX="550" layoutY="40" prefWidth="200" prefHeight="50" buttonType="FLAT" text="FLAT 按钮 禁用" style="-fx-font-size: 14px; -fx-background-color: #F4A460;" disable="true"/>
<JFXButton layoutX="50" layoutY="120" prefWidth="200" prefHeight="50" buttonType="RAISED" text="RAISED 按钮 无底色" style="-fx-font-size: 14px;"/>
<JFXButton layoutX="300" layoutY="120" prefWidth="200" prefHeight="50" buttonType="RAISED" text="RAISED 按钮 有底色" style="-fx-font-size: 14px; -fx-background-color: #F4A460;"/>
<JFXButton layoutX="550" layoutY="120" prefWidth="200" prefHeight="50" buttonType="RAISED" text="RAISED 按钮 禁用" style="-fx-font-size: 14px; -fx-background-color: #F4A460;" disable="true"/>
以上,可以看出,FLAT 属性是常规按钮,RAISED 是一种带有阴影效果的按钮样式,两者在点击时均有动态效果。