I'm using an external css file called mainBut.css
to align the text of a JavaFX button,
Code for the button:
<Button fx:id="hostelBut"
layoutX="7.0"
layoutY="100.0"
onAction="#hostelAction"
prefHeight="30.0"
prefWidth="150.0"
styleClass="mainBut"
stylesheets="@../resources/css/mainBut.css"
text="Hostel">
The mainBut.css
file
.mainBut {
-fx-background-color: #fdfdfd;
-fx-alignment: LEFT;
-fx-border-color: #bdc3c7;
}
When I compile this file and run it via NetBeans, I get the following warning.
WARNING: Caught java.lang.IllegalArgumentException: No enum constant javafx.geometry.Pos.LEFT' while calculating value for '-fx-alignment' from rule '*.mainBut' in stylesheet jar:file...
What can I do to fix this warning?
LEFT
is not a valid value for the -fx-alignment
property. Valid values are:
[ top-left | top-center | top-right | center-left | center | center-right bottom-left | bottom-center | bottom-right | baseline-left | baseline-center | baseline-right ]
Those values are mapped to their corresponding enum in Pos
class.
You probably want center-left
instead, which represents positioning on the center vertically and on the left horizontally.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With