我正在尝试在javafx webview中实现弹出处理程序,它生成弹出窗口并将其添加到同一个fxpanel但我想将它显示在新窗口上。我使用以下代码。
try
{
Webview webview,smallView
final Group group= new Group();
Scene scene= new Scene(group);
fxpanel.setScene(scene);
webview = new WebView ();
group.getChildren().add(webview);
eng= webview.getEngine();
String url ="http://www.timetrim.in/webchatserver2/default.aspx";
eng.load(url);
smallView = new WebView();
smallView.setPrefSize(400, 200);
eng.setCreatePopupHandler(
new Callback<PopupFeatures, WebEngine>() {
@Override
public WebEngine call(PopupFeatures config) {
smallView.setFontScale(0.8);
if (!group.getChildren().contains(smallView)) {
group.getChildren().add(smallView);
}
return smallView.getEngine();
}
});
}
catch(Exception ex){ex.printStackTrace();}