Hi,

 

I am developing code to load my application through Webengine.My application has been developed in ember so all my scripts called in within html page.

 

When i ran below program i am seeing white screen it doesn't load my application but, i am able to load other sites like google...

 

Need help how to resolve this issue. whether javafx web engine capable of loading ember. I am using jfxrt.jar version 7 and 8

 

Any help would be really appreciated.

 

code for your reference.

 

import javax.script.ScriptEngine;

 

 

import netscape.javascript.JSObject;

import javafx.application.Application;

import javafx.beans.value.ChangeListener;

import javafx.beans.value.ObservableValue;

import javafx.concurrent.Worker;

import javafx.concurrent.Worker.State;

import javafx.scene.Group;

import javafx.scene.Scene;

import javafx.scene.control.ScrollPane;

import javafx.scene.web.WebEngine;

import javafx.scene.web.WebView;

import javafx.stage.Stage;

/*from ww w  .ja  v  a2  s. c  o  m*/

public class Main extends Application {

  @Override

  public void start(final Stage stage) {

    stage.setWidth(400);

    stage.setHeight(500);

    Scene scene = new Scene(new Group());

 

 

 

 

    final WebView browser = new WebView();

    final WebEngine webEngine = browser.getEngine();

 

 

    ScrollPane scrollPane = new ScrollPane();

    scrollPane.setContent(browser);

 

 

    webEngine.getLoadWorker().stateProperty()

        .addListener(new ChangeListener<State>() {

          @Override

          public void changed(ObservableValue ov, State oldState, State newState) {

        

            if (newState == Worker.State.SUCCEEDED) {

              stage.setTitle(webEngine.getLocation());

              System.out.println("finished loading");

              String html = (String) webEngine

                  .executeScript("document.documentElement.outerHTML");

              System.out.println(html);

          

                       }

 

 

          }

        });

   

  webEngine.setJavaScriptEnabled(true);

   webEngine.load("http://abced.cccc.com:8080/PPP/index.html");      

 

 

    scene.setRoot(scrollPane);

    stage.setScene(scene);

    stage.show();

  }

 

 

  public static void main(String[] args) {

    launch(args);

  }

}

FacebookTwitterLinkedin
Pin It
Joomla Tutorials for Beginners