JavaFx:2、application的启动方式和生命周期

package fx.com;

import javafx.application.Application;
import javafx.stage.Stage;

public class Main3 extends Application {
    public static void main(String[] args) {
        System.out.println("Main():"+Thread.currentThread().getName());
        Application.launch(Main3.class,args);
    }

    @Override
    public void init() throws Exception {
        System.out.println("Init():"+Thread.currentThread().getName());
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        System.out.println("Start():"+Thread.currentThread().getName());
        primaryStage.setTitle("Hello World");
        primaryStage.show();
    }

    @Override
    public void stop() throws Exception {
        System.out.println("Stop():"+Thread.currentThread().getName());
    }
}

posted @ 2020-09-25 19:16  xl4ng  阅读(835)  评论(0)    收藏  举报