I'm trying to create a textfield with a title embedded in the field border like:
Following the solution posted here I've created a .java file called TitledBorder.java
within my src>main>java
directory. My FXML is in the src>main>resources
directory and I've added:
<?import TitledBorder?>
at the top and it shows no error like:
I then added this code to the FXML
<HBox prefHeight="100.0" prefWidth="200.0">
<children>
<TitledBorder title="Email" >
<TextField fx:id="emailField" prefHeight="44.0" prefWidth="143.0" />
</TitledBorder>
</children>
</HBox>
and it shows no error either. I then launch my main method which is in a class also in src>main>java but it gets an error in the .fxml saying javafx.fxml.LoadException:
/C:/Users/ME/Documents/Automation/target/classes/demofxml.fxml
and
Caused by: java.lang.ClassNotFoundException
at javafx.fxml.FXMLLoader.loadType(FXMLLoader.java:2899)
I'm not sure why it references "/target/classes/..." as opposed to "/src/main/java/...".
This is the only FXML example I've found so I'm confused why I'm getting an error upon compiling, yet no errors are shown prior? Removing all reference to TitledBorder
allows all my code to function/compile properly. Since its in the src package I use this code in FXML to connect w/ controller fx:controller="loadController">
. CSS is added properly too.
Thoughts?