Answer the question
In order to leave comments, you need to log in
How to do something when opening a window in JavaFX FXML?
Hello, I started to understand JavaFX and FXML)
There was such a question, how in JavaFX + FXML to launch some kind of action immediately after the application starts?
Those. without any buttons, etc., I just want the for loop to create 10 rectangls immediately after the application starts, but I don’t understand how, because I only know how to do it by clicking on the button)
I have an empty template with a fxml file, a controller and an App class..
<BorderPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="org.javilingys.MiniPlayerController"
prefHeight="400.0" prefWidth="600.0"
stylesheets="css/stylesheet.css">
</BorderPane>
Answer the question
In order to leave comments, you need to log in
In the case of FXML, you still cannot access fxml elements from the controller constructor, but there is an initialize () method that works after the entire fxml has been initialized, use it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question