My java web browser don't display alert("message"); and confirm("message"); either, I ussually use c# web Browser component and it's works perfectly but I'm new at this.
public void openPage(String url){
JFXPanel jfxPanel = new JFXPanel();
JFrame frame = new JFrame("");
frame.add(jfxPanel);
Platform.runLater(() -> {
WebView webView = new WebView();
jfxPanel.setScene(new Scene(webView));
webView.getEngine().load(url);
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
});
}
I found a pretty solution :)
for alert:
for confirm:
For
alert
, register anonAlert
handler with the web engine. Forconfirm
, register aconfirmHandler
with the web engine. See the "User interface callbacks" section of theWebEngine
documentation.Here's a quick example: