0
喜歡點擊按鈕,想爲我的屏幕負載做同樣的事情,我使用場景生成器。 這裏是我的代碼:JavaFx事件像Onload
public class CModifierBoutique implements ControlledScreen{
@FXML
ChoiceBox<String> box;
ScreensController myController;
@Override
public void setScreenParent(ScreensController screenPage) {
myController = screenPage;
}
@FXML
private void goToMain(ActionEvent event){
myController.setScreen(ScreensFramework.screen1ID);
}
@FXML
private void inialize(ActionEvent event){
System.out.println(" there is the method who must be start on load this screen ");
System.out.println("my code is requesting the data base and the result");
System.out.println("will be added to my choisebox");
BoutiqueDao dao=new BoutiqueDao();
List<Boutique> li=dao.DisplayAll();
}
}
是的,但我想加載就在屏幕上「X」會被加載,因爲當我實現了初始化,它的工作原理當我的第一個屏幕將被加載 –
是否有類似於javafx線程(GUI完成加載後)的初始化的替代方法。 ? – Mercury
@Mercury不清楚你在問什麼。這正是initialize()所做的。 –