11

I want to embed google maps on a JPanel. Since I want features like zoom-in/out, using static images isn't feasible.

To achieve this, I'll probably need to embed a webpage (which displays google maps) in my Java desktop application. And I've read that I'll need something like WebKit (alternatives?) to accomplish this.

I'd appreciate any help that'll help me:

  1. Embed a webpage in a Jpanel.
  2. That webpage to display google maps.
satnam
  • 1,457
  • 4
  • 23
  • 43
  • Try the answers given [here](http://stackoverflow.com/questions/2737363/is-there-a-swing-component-for-google-maps). :) – Stefan Oct 31 '13 at 08:04

2 Answers2

12

Yes, the Google Maps APIs can now be used in Desktop applications

Check out these Stack Overflow threads:

Google Map in JAVA Swing

Embedding Gecko/Webkit in Java

Webkit browser in a Java app

Rendering webpages with WebKit in Java

You can also see the tutorail of using Maps in Java Desktop Application.

Community
  • 1
  • 1
Imran
  • 5,376
  • 2
  • 26
  • 45
3

You can use JxMaps library to complete this task. It has Swing component which can be simply embedded to JPanel.

void createMapView(JPanel parent) {
    MapView view = new MapView();
    parent.add(view);
}

This library has comprehensive set of classes for working with Google Maps from java.

Neuron
  • 5,141
  • 5
  • 38
  • 59
Vitaly Eremenko
  • 341
  • 1
  • 5