JavaFx:5、platform类的使用

package fx.com;

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

public class Main extends Application {
    public static void main(String[] args) {
        launch(args);
    }
    @Override
    public void start(Stage primaryStage) throws Exception {

        Platform.setImplicitExit(false);
        primaryStage.show();
        // 检查是否支持某种特性
        System.out.println(Platform.isSupported(ConditionalFeature.SCENE3D));
        // 必须调用Platform.exit()程序才能退出
        Platform.exit();

        // 延时加载
        Platform.runLater(new Runnable() {
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName());
            }
        });
    }
}
posted @ 2020-09-29 22:05  xl4ng  阅读(950)  评论(0)    收藏  举报