java如何在关闭时关闭webview?JavaFx
Platform.runLater(() -> {
WebView wv = new WebView();
final WebEngine engine = wv.getEngine();
fxpanel.setScene(new Scene(wv));
engine.setJavaScriptEnabled(true);
engine.load(Url);
};
当我关闭这个框架时,当这个WebView
打开时,我可以看到它们在后台运行,所以我尝试在一个公共的void类中这样关闭它,但是它没有正确关闭,所以我怎么做呢
public static void closeframe() {
Platform.setImplicitExit(false);
if (ClassName != null) {
ClassName.frame.dispose();
Platform.runLater(() -> {
wv = new WebView();
ClassName.wv.getEngine().reload();
ClassName.wv = null;
ClassName.frame = null;
});
# 1 楼答案
在停止方法中退出平台,如下所示: