package top.octopusyan.utils;

import javafx.fxml.FXMLLoader;
import javafx.fxml.JavaFXBuilderFactory;

import java.nio.charset.StandardCharsets;

/**
 * <p> author : octopus yan
 * <p> email : octopus_yan@foxmail.com
 * <p> description :
 * <p> create : 2022-4-9 01:45 *
 */
public class FxmlUtil {

//    public static FXMLLoader init(String path) {
//        FXMLLoader fxmlLoader = new FXMLLoader();
//        fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
//        fxmlLoader.setLocation(FxmlUtil.class.getResource(path));
//        return fxmlLoader;
//    }

    public static FXMLLoader init(String path) {
        return new FXMLLoader(
                FxmlUtil.class.getResource(path),
                null,
                new JavaFXBuilderFactory(),
                null,
                StandardCharsets.UTF_8
        );
    }
}
