Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warning given for -fx-alignment: LEFT saying no enum constant javafx.geometry.Pos.LEFT

Tags:

java

css

javafx

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?

like image 273
Rizan Zaky Avatar asked Nov 02 '15 10:11

Rizan Zaky


1 Answers

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.

like image 117
Tunaki Avatar answered Nov 11 '22 13:11

Tunaki