title: JavaFX - Giving WebView a URL through Scene Builder or NetBeans
body: <p>I'm a beginner at JavaFX.</p>
  
  <p>I've made my layout in JavaFX Scene Builder. In that I've left a WebView but I cannot figure how to give it a URL.</p>
  
  <p>In a separate class I've my WebView ready</p>
  
  <pre><code>public class GoogleApp extends Application {
  
  private Scene scene;
  MyBrowser myBrowser;
  
  /**
  * @param args the command line arguments
  */
  public static void main(String[] args) {
    launch(args);
   }
  
   @Override
    public void start(Stage primaryStage) {
    primaryStage.setTitle("Railway Scenario Development");
  
    myBrowser = new MyBrowser();
    scene = new Scene(myBrowser, 800, 600);
  
    primaryStage.setScene(scene);
    primaryStage.show();
  }
  
  class MyBrowser extends Region{
  
    HBox toolbar;
  
    WebView webView = new WebView();
    WebEngine webEngine = webView.getEngine();
  
    public MyBrowser(){
  
        final URL urlGoogleMaps = getClass().getResource("demo.html");
        webEngine.load(urlGoogleMaps.toExternalForm());
  
        getChildren().add(webView);
  
    }
  
   }
   }
  </code></pre>
  
  <p>But I need to embed that in my application which I've made in Scene Builder. In Scene Builder there is a WebView Panel and I want that panel to look like the code I've mentioned above.</p>
  
  <p>My application's code uses the fxml file as its "scene" (Shown below). </p>
  
  <pre><code>public class Railway extends Application {
  
  private Scene scene;
  
  
  @Override
  public void start(Stage stage) throws Exception {
      Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
      stage.setTitle("Railway Scenario Development");
  
      scene = new Scene(root);
  
      stage.setScene(scene);
      stage.show();
  }
  
  
  public static void main(String[] args) {
      launch(args);
  }
  
  }
  </code></pre>
  
  <p>I figure I've to do something in the FXMLDocumentController file. But how and what. Please guide.</p>