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:
Embed a webpage in a Jpanel.
That webpage to display google maps.
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.
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.
Related
I am making an application in java which would be showing a HTML web page, getting the address of the webpage from a config file. The web page will be on the local disk. Now what i want is, when i start the Java program, the program will be showing the the webpage fullscreen on the computer without the mouse cursor. Now for that i would be first needing a HTML Engine or a web browser which can run inside the java application(events liek press of button etc etc will be passed to the web page from the java application). I cant find a way to show these web pages. I would be needing to show current tech web pages , such that it can process everything from jQuery, Js, Ajax, CSS3, HTML 5. So that beautiful web pages are able to be shown through the Java program.
JxBrowser is a good api for such purpose. It uses the chromium engine which offers an optimum speed just like native browsers. I have used it and it worked for me
Maybe you can give a try to jxbrowser
It promise to be a very good component.
From the home page:
Embed a lightweight Chromium-based Swing component into your Java
application to display modern web pages built with HTML5, CSS3,
JavaScript, Flash, Silverlight etc.
This is possible if you're willing to use javaFx.
I'm not sure to which extent the latest html5 and css3 goodies are supported, but it's a decent browser enough : java fx WebView component
You can try using the SWT Browser control if your application runs on Windows.
It wraps the currently installed Internet Explorer and gives you a very powerful access to its functionality including event listeners, etc.
I'm preparing to deploy a game developed using LIBGDX for both android and Desktop computers. Is there a way to put ads in a desktop application? I'd like to generate revenue from the desktop ads too.
You'd have to stick a browser widget in your desktop application and display adverts in there. JEditorPane's HTML support is pretty primitive, however, so you'd have to search for an embeddable Java browser or a custom subclass of JEditorPane which supports modern HTML (I think JEditorPane support stops at HTML 3.2). There are some freely available alternatives just a Google search away.
Off the top of my head, I can't think of any advertising networks geared towards desktop applications at all, so the browser approach is probably your only real shot at doing what you want.
I have added JavaHelp to my web application, but now I need to include videos in the content (html)files. As far as I can read here I need to implement a lightweight component, and I can use the video viewer included in the Java 2 platform, but I am lost as to how to that.
Can anyone here walk me through the steps necessary to implement this?
As far as I can tell I need to
include an applet using the tags.
write the applet, basing it on the Java 2 video viewer
pack the applet??
I hope one of you has experience with this.
Is there any java library which is an opensource and also has the capabilities of animation .I know about JFreeChart but its charts are not that much attractive and secondly they also do not have animation feature.
Secondly i do found javafx .Kindly give me an idea is it difficult to associate javafx charts with java code? Please guide me.
Have a look at Charting and Reporting # java-source.net and 15 useful Java Java Charting and Reporting Tools.
It is simple to associate JavaFX charts with Java Code. For example, the following Java code will create a JavaFX PieChart:
final PieChart chart = new PieChart(FXCollections.observableArrayList(
new PieChart.Data("Oranges", 25),
new PieChart.Data("Pears", 22),
new PieChart.Data("Apples", 30)
));
If you use the JavaFX charts, make sure you are using the newest JavaFX 2 code base (where the JavaFX code is written in Java) rather than the older JavaFX 1.3 code base (where the JavaFX code is written in a specialized script language).
JavaFX has a charting API and an animation API, but not a specific API for animating charts. You can perform animation on chart elements using JavaFX, but you need to either write the API and code to perform the animation on the charts yourself or base your chart on JavaFX Ensemble sample (which is not a full animation API for charts).
To help determine whether JavaFX charting is a good match for your application, review the JavaFX Samples. The Ensemble sample application has examples for both static and animated charts. The SwingInterOp sample application has an example of embedding a JavaFX graph inside a traditional Java Swing application. There is good documentation on JavaFX charting.
Note that JavaFX (as of 2.0.2) does not currently have a printing API, in case printed charts is also a consideration, though you could leverage the printing capabilities of Swing if needed.
I'm going to embed Flex components into Java app, just embedding swf into JFrame. Does anybody know how to use EZ JCOM ? I don't know what is Flash COM or Flash ActiveX. please help me
Im working on a swing app that does exactly the same, i have a firefox instance embebbed on a swing app. For that iam using the following library, check it out The DJ Project