简体   繁体   English

如何在java swing应用程序中显示地图?

[英]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.我正在开发一个应用程序,我必须在JPanel显示特定区域/区域(使用纬度和经度)的地图,除了放大/出去。 I have no idea on how this can be achieved, some links explaining this would be of great help.我不知道如何实现这一点,一些解释这一点的链接会很有帮助。

Take a look to JxMaps library.看看JxMaps库。 Using this library you can easily embed map viewer to any Swing container.使用这个库,您可以轻松地将地图查看器嵌入到任何 Swing 容器中。

After embedding of MapView to your application, library gives you access to Map object, that has methods for both map positioning and zooming.MapView嵌入到您的应用程序后,库使您可以访问Map对象,该对象具有用于地图定位和缩放的方法。

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

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 在 Java 桌面应用程序中嵌入谷歌地图

Here is an exact copy of their answer:这是他们答案的精确副本:

Yes, the Google Maps APIs can now be used in Desktop applications是的,Google Maps API 现在可以在桌面应用程序中使用

Check out these Stack Overflow threads:查看这些 Stack Overflow 线程:

Google Map in JAVA Swing JAVA Swing中的谷歌地图

Embedding Gecko/Webkit in Java 在 Java 中嵌入 Gecko/Webkit

Webkit browser in a Java app Java 应用程序中的 Webkit 浏览器

Rendering webpages with WebKit in Java 使用 Java 中的 WebKit 渲染网页

You can also see the tutorail of using Maps in Java Desktop Application.您还可以查看在 Java 桌面应用程序中使用地图的教程

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM