WebEngine
状態でテーブル、それに対応するWebEngineとJavaScriptのユーザ・インタフェース・メソッドとプロパティコールバック。
window.close()
は、WebEngine
のonVisibilityChanged
コールバックに対応します。
試す簡単な方法、その場合には、次のようになります。
webEngine.getOnVisibilityChanged().handle(closeWindowEvent); //event definition below
あなたは、ウィンドウを確認している
webEngine.executeScript("window.close()");
別の方法が続きます閉じられているイベントは、WebView's EventDispatcher
によってディスパッチされたイベントを定義することです現在のノード。唯一のWebページをロード解除しようとした場合には
// Here the event to be dispatched for closing the window shall be
WebEvent<Boolean> closeWindowEvent = new WebEvent<>(webEngine, VISIBILITY_CHANGED, Boolean.FALSE);
webView.getEventDispatcher().dispatchEvent(closeWindowEvent, null); // no further events
、あなたは何をするexecuteScript
を利用することができます:
webEngine.executeScript("window.stop()");
あなたの男の子でありますウィンドウを閉じるのではなく、ウェブページの読み込みをキャンセルするだけです。 – Pablo
@Pablo 'window.stop()'はその場合にあなたを助けます...? – nullpointer