Mapping controller class with its FXML file
Suppose your controller class is :
class SettingController implemets Initializable{
@FXML
Vbox settingsFXML;
@Override
public void initialize(URL location, ResourceBundle resources) {
}
}
And Here is your fxml :
Setting.fxml :
<VBox id="settingsFXML" fx:id="settingsFXML" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.ibadmin.settings.SettingsController">
</VBox>
Note that : In fxml we write one attribute "fx:controller" to map contrller with fxml file.
pass class path to this attribute.
also Note that we assign id to this fxml as :"setitngsFXML" :we use this id as object in controller to use fxml components(not necessary ).
class SettingController implemets Initializable{
@FXML
Vbox settingsFXML;
@Override
public void initialize(URL location, ResourceBundle resources) {
}
}
And Here is your fxml :
Setting.fxml :
<VBox id="settingsFXML" fx:id="settingsFXML" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.ibadmin.settings.SettingsController">
</VBox>
Note that : In fxml we write one attribute "fx:controller" to map contrller with fxml file.
pass class path to this attribute.
also Note that we assign id to this fxml as :"setitngsFXML" :we use this id as object in controller to use fxml components(not necessary ).
Comments
Post a Comment