1

I'm trying to load a Google Maps page inside my JavaFX application using webView and webEngine. Somehow, it doesn't load anything and I don't know why. Could you please help?

@FXML WebView webView;
WebEngine webEngine;
webView = new WebView();
webEngine = webView.getEngine();
webEngine.load("https://maps.google.de");
3
  • 3
    Try removing webView = new WebView();. You’re creating a new WebView that is replacing the one defined in your FXML file and therefore is not a part of your Stage (probably). Commented Apr 12, 2019 at 17:29
  • 1
    Thank you! :) That's the solution. Commented Apr 12, 2019 at 17:35
  • 1
    Could you move the answer to the answers section and mark thread as solved? Commented Apr 12, 2019 at 17:37

1 Answer 1

2
@FXML WebView webView;
WebEngine webEngine;
webEngine = webView.getEngine();
webEngine.load("https://maps.google.de");

Removing webView = new WebView(); fixed it!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.