JavaFX WebView doesn't render JSF page correctly (symbols instead of values from beans)

257 Views Asked by At

I have created very simple app that is displaying URL using JavaFX WebView:

static JFXPanel fxPanel;
static WebView wv;
static JFrame frame;

public static void main(String[] args){
     try {
          fxPanel = new JFXPanel ();
          com.sun.javafx.application.PlatformImpl.runLater ( new Runnable () {
               @Override
               public void run () {
                    wv = new WebView ();
                    wv.getEngine ().load ( "http://localhost:8080/WebApp/" );
                    fxPanel.setScene ( new Scene ( wv, 1000, 750 ) );
                    frame = new JFrame ( "Google" );
                    frame.add ( new JScrollPane ( fxPanel ) );
                    frame.setDefaultCloseOperation ( JFrame.EXIT_ON_CLOSE );
                    frame.setVisible ( true );
                    frame.pack ();
               }
           } );
     } catch ( Exception ex ) {
}

I use it to render a webpage with my JSF application. App renders perfectly using a web browser, however it fails when rendered from JFXPanel.

Funny thing is that texts fetched from backing beans are not rendered correctly, where resources from message bundle are displayed OK. Please see attached screenshots.Wrong Display and Correct Display

1

There are 1 best solutions below

0
On

I have found this answer and it solves my question.

The problem is with loading fonts that is messing the WebView. Solution was removing links to external fonts that I had on my page.