cyberpirate92
cyberpirate92

Reputation: 3186

how to display a map in a java swing application?

I am developing an application where I have to display a map of a particular area/region (using latitude and longitude) in a JPanel, I need no additional functionality (like placing markers,etc..) from the map except for zooming in/out. I have no idea on how this can be achieved, some links explaining this would be of great help.

Upvotes: 6

Views: 9985

Answers (2)

Vitaly Eremenko
Vitaly Eremenko

Reputation: 341

Take a look to JxMaps library. Using this library you can easily embed map viewer to any Swing container.

After embedding of MapView to your application, library gives you access to Map object, that has methods for both map positioning and zooming.

Map map = viewer.getMap();
map.setCenter(new LatLng(map, 10, 20);
map.setZoom(8);

Upvotes: 3

Steven Jeffries
Steven Jeffries

Reputation: 3582

Sorry, I don't have enough rep to add a comment, or I would just comment it, but this question answers that:

Embed google maps in Java desktop Application

Here is an exact copy of their answer:

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.

Upvotes: 1

Related Questions