I am new to fxml programming and am wanting to pass the value from a textbox created in my fxml to my controller. i have wired up
fx:controller="sample.Controller"
so the controller can talk to the fxml - but this is the code I have, but I'm getting this error
<TextField fx:id="txtSearchTerm" layoutX="188.0" layoutY="56.0" />
@FXML TextField txtSearchTerm;
@FXML
private void QueryDB(ActionEvent event)
{
//do stuff here\
String selectedvalue = txtSearchTerm.getText();
}
What is the proper way to set this up?
Make sure that the type of TextField
is from the javafx.scene.control
namespace and not from the java.awt
namespace