Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Java 8 WebView

fischeApr 1 2014 — edited Apr 3 2014

Hey guys,

Actually i'm using java 8 and the webview with GoogleMap last API. And I got some problem with the zoom in/out.

It's very very slow and for my work it's disturbing.

Maybe someone else have the same problem or know an issue that I didn't know for resolv it.

Thanks.

Fische

Comments

Macdevign

You mean you are using old version of GoogleMap API  ? What OS platform are you using ?

fische

No the last API. The google map API v3 https://developers.google.com/maps/documentation/javascript/

My slowness on the webview is under windows (7, 8) / MAC OS (last version) / Linux (fedora 20)

Macdevign

I using Java8 with Mac Mavericks , and I have to say webview run as fast as in chrome from your link

https://developers.google.com/maps/documentation/javascript/

when zooming in/out using the zoom control , panning etc.

I didn't experience any performance issue whatever so from webview running google map (satellite mode etc)

though I'm not too sure about windows , linux or mac mountain lion or below since I don't have them to test.

The following is my test code in start method

public void start(Stage s) throws Exception

{

BorderPane pane = new BorderPane();

            s.setScene(new Scene(pane, 500, 500));

            s.setWidth(499);

            s.setHeight(300);

            final WebView webView = new WebView();

            pane.setCenter(webView);

            webView.setPrefSize(Double.MAX_VALUE, Double.MAX_VALUE);

            Button but = new Button("Load site");

            but.setPrefWidth(Double.MAX_VALUE);

            but.setOnAction(e -> {

                webView.getEngine().load("https://developers.google.com/maps/documentation/javascript/");

            });

            pane.setBottom(but);

            s.show();

}

fische

Yes when you load the website its ok but I speak about use google map in full version with the API.

So you have your own html file and load google map with your key and use it for your own.

Ask more if you want more precision. But I speak about use the google map API.

Here is the html file we use:

<!DOCTYPE html>

<html>

    <head>

        <style>

            html, body {

                height: 100%;

                width: 100%;

            }

            #mapcanvas { height: 100%; width: 100%}

        </style>

        <script type='text/javascript'>

            function loadScript() {

                var script = document.createElement('script');

                script.type = 'text/javascript';

                script.src = 'https://maps.googleapis.com/maps/api/js?libraries=weather&sensor=false&' +

                        'callback=initialize';

                document.body.appendChild(script);

            }

            var GGMaps = null;

            function initialize() {

                var myOptions = new Array();

                this.map = null;

                this.mapZoom = 6;

                this.mapCenter = new google.maps.LatLng(48.856667, 2.350987);

                this.mapTypeId = google.maps.MapTypeId.ROADMAP;

                myOptions["zoom"] = this.mapZoom;

                myOptions["center"] = this.mapCenter;

                myOptions["mapTypeId"] = this.mapTypeId;

                this.map = new google.maps.Map(document.getElementById("mapcanvas"), myOptions);

                console.log('NEW INSTANCE');

            }

            window.onload = loadScript;

        </script>

    </head>

    <body>

        <div id="mapcanvas"></div>

    </body>

</html>

Just load it like you post before.

Fische

Macdevign

Yes. I try it and performance seems erratic sometimes ok and sometimes slow. Odd enough I find map from google site is fast.

I suggest you vote for the jira on webview performance.

https://javafx-jira.kenai.com/browse/RT-33217

1 - 5
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on May 1 2014
Added on Apr 1 2014
5 comments
5,535 views