#JavaFX how work

5 messages · Page 1 of 1 (latest)

ancient rover
#

Okay so you call the static launch method from the Application class. How does it figure out how to initialize this subclass of Application? The start(Stage) method runs.

umbral spokeBOT
#

This post has been reserved for your question.

Hey @ancient rover! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

blazing gust
#

In java,if you run a sub class,it will initialize super class first,and then the sub class got the methods and attributes in super class

tacit zodiac
#

When the static launch() method is called from the Application class, the JavaFX runtime creates an instance of the specified subclass of Application and calls its start(Stage) method. This method initializes the primary stage, creates the scene graph, and sets up the UI components of the application.

The Stage parameter passed to the start method represents the primary stage, which is the top-level window of the application that contains all the UI components. Once the start method is called, the JavaFX runtime enters the event processing loop and waits for user input events to update the UI components.

The launch() method also initializes the JavaFX toolkit, which handles the event processing and rendering of the UI components. This environment setup allows the application to interact with the user.

Overall, the launch() method of the Application class sets up the JavaFX environment, initializes the subclass of Application, and starts the event processing loop, enabling the user to interact with the application's UI.