JavaFX - CSS 1px 溢出按钮
JavaFX - CSS 1px overflow button
我的应用程序中有一个普通的经典按钮,它是使用 JavaFX Scene Builder 2.0 构建的。我想添加一些样式,所以我链接了场景和 .css 文件,它看起来像:
.button {
-fx-background-color: rgba(255,255,255,0.9);
-fx-border-style: solid;
-fx-border-color: grey;
-fx-border-width: 1px;
-fx-max-height: 40px;
}
在 fxml 文件中,按钮的首选项宽度为 46px,结果如下:
我们可以在它的底部看到某种 1px 的溢出,我不知道如何让它消失。这是 FXML 文件:
<HBox fx:id="footerLayout" alignment="CENTER_LEFT" layoutX="14.0" layoutY="489.0" prefHeight="100.0" prefWidth="1102.0">
<children>
<Button fx:id="addDetenuButton" mnemonicParsing="false" prefHeight="46.0" prefWidth="215.0" text="Ajouter un détenu" />
<Separator prefWidth="10.0" visible="false" />
<Button fx:id="editDetenuButton" mnemonicParsing="false" prefHeight="46.0" prefWidth="215.0" text="Modifier le détenu" />
<Separator prefWidth="565.0" visible="false" />
<Button fx:id="closeButton" mnemonicParsing="false" prefHeight="46.0" prefWidth="105.0" text="Quitter" />
</children>
</HBox>
我明白了为什么……我补充说:
-fx-background-insets: 0;
到
.button {
-fx-background-color: rgba(255,255,255,0.9);
-fx-border-style: solid;
-fx-border-color: grey;
-fx-border-width: 1px;
-fx-max-height: 40px;
}
成功了,"white shadow" 不见了!
我的应用程序中有一个普通的经典按钮,它是使用 JavaFX Scene Builder 2.0 构建的。我想添加一些样式,所以我链接了场景和 .css 文件,它看起来像:
.button {
-fx-background-color: rgba(255,255,255,0.9);
-fx-border-style: solid;
-fx-border-color: grey;
-fx-border-width: 1px;
-fx-max-height: 40px;
}
在 fxml 文件中,按钮的首选项宽度为 46px,结果如下:
我们可以在它的底部看到某种 1px 的溢出,我不知道如何让它消失。这是 FXML 文件:
<HBox fx:id="footerLayout" alignment="CENTER_LEFT" layoutX="14.0" layoutY="489.0" prefHeight="100.0" prefWidth="1102.0">
<children>
<Button fx:id="addDetenuButton" mnemonicParsing="false" prefHeight="46.0" prefWidth="215.0" text="Ajouter un détenu" />
<Separator prefWidth="10.0" visible="false" />
<Button fx:id="editDetenuButton" mnemonicParsing="false" prefHeight="46.0" prefWidth="215.0" text="Modifier le détenu" />
<Separator prefWidth="565.0" visible="false" />
<Button fx:id="closeButton" mnemonicParsing="false" prefHeight="46.0" prefWidth="105.0" text="Quitter" />
</children>
</HBox>
我明白了为什么……我补充说:
-fx-background-insets: 0;
到
.button {
-fx-background-color: rgba(255,255,255,0.9);
-fx-border-style: solid;
-fx-border-color: grey;
-fx-border-width: 1px;
-fx-max-height: 40px;
}
成功了,"white shadow" 不见了!