JavaFX + Web Service + Maps + Navigation

Just a small demo of JavaFX + Web Services. From JavaFX, its quite easy to work on Web Services like maps, search, pictures .. There are lot of Web services demo in the sample space

Here I have contact list of person, which has name, email ID, phone no, address and thumbnail images. Everything has a different work but here we are willing to see the address work. On clicking contact list's, will show me his location in maps. Actually there are two ways to do that, fast way and good way. We can store the maps in Database and use it when required, other is we call the web service and take the map on demand from Yahoo or Google API, which will be slow. So, we will go with good way.

Considering only one contact.


Some fancy stuff, like clicking the + sign will open address option. Now, on clicking the address, we will call the yahoo maps API for showing the location of the person Joseph J.

Actually its a mobile application, and can be viewed in mobile as well(just that I am not putting image). So, in basic code of Map show, we did :

// in place of Sunnyvale and CA, it will be {city} and {state} which will be the variables and passed from main code.

var url = bind "http://local.yahooapis.com/MapsService/V1/mapImage?appid=GetApp;city=Sunnyvale&state=CA";

   var p: PullParser;
   var h: HttpRequest;
   init {
           if (url.length() > 0) {
           h = HttpRequest {
               location: url
                onException: function(exception: Exception) {
                }

                onInput: function(input) {

                   p = PullParser {
                       input: input
                       onEvent: function(event) {

                           if ((event.type == PullParser.END_ELEMENT)) {
                               if (event.qname.name == "Result") {
                                   location = event.text; //this will give a URL for image
                               }
                          }
                       }
                   };
                   p.parse();
                   p.input.close();
      .......

Lot of further code. Important of it is OnDone method where we have to write some code of cleaning or loading prev. data. I have also embed my long back code of navigation, which will help us into navigation in the map.

Ignore some minor mistakes, have a look at the jnlp:

Soon, I will post the whole application with code, but the basic idea is simple and can be doable. 

Comments:

hi vaibhav i converted another demo from flash to JavaFX please see it http://farrukh.hostrator.com
i have some questions i ask rakesh as well
In flash there is function loadLibrary(.swf) that will loadd swf at user request this is very useful function suppose there is a contact link button in website and user is not intererted in viewing that so it is ineffecient to load that jar file can we do that kind of stuff in javafx on user request the demo will be loaded and shown in progress bar..

Posted by Farrukh Obaid on April 16, 2009 at 08:46 PM IST #

Awesome Sample !

So, are you talking of multiple jar files. If your contact button is there means jar is already loaded.

Can you please explain ! Progress bar and other thing are doable.

Posted by Vaibhav Choudhary on April 17, 2009 at 02:25 AM IST #

my question was that let suppose i have two demos in one jar file at startup only buttons should load and when user click on buttons the demo link to the button should load and the progress of loading is shown in Progress bar.. if it is not possible can it will be done using multiple jar containing the separate demos

Posted by Farrukh on April 17, 2009 at 08:23 PM IST #

Hmmm, I guess you are talking of loading jar file at run time. I am afraid, but there is no direct way in java to do so, security sounds most reasonable reason for that. But you can write a classloader which can do that. Probably try to find out on URLClassLoader extensions.. you will get something on net.

Another way to use some 3rd party package which can help you in doing it, like org.apache.xbean.classloader.JarFileClassLoader

Posted by Vaibhav on April 18, 2009 at 04:40 PM IST #

Hi Vaibhav,
can you please pass the code for Yahoomap navigation in java FX

Posted by Sam on May 12, 2009 at 01:32 PM IST #

Sure, let me add code somewhere in the blog. Yahoo Map can let you work on zip code or address. Address parsing is tedious and give scope for error as well, so i use Zip :). You can try with Address.

I will add the code in this blog only today.

Posted by Vaibhav Choudhary on May 13, 2009 at 01:49 AM IST #

thanks vaibhav,

I am waiting for the your code.I also need zip code to get me the location.

Posted by Sam on May 14, 2009 at 03:52 AM IST #

One more thing vaibhav,do u have any idea how to drag a lebel and put the value inside text box in java FX.I have some idea how to do it using JComponent.But i wanted to see it in FX.

Posted by Sam on May 14, 2009 at 03:54 AM IST #

can we use javafx for rendering the map in to the web browser

Posted by anshu on May 20, 2009 at 09:51 AM IST #

This is my first post on blogs.sun.com. I hope to use this space do discuss current topics in the areas on web application security and data privacy.
http://www.watchrolexshop.com
http://www.gamegoldme.com
http://www.cheap-lotrogold.com
http://www.globalsale.me/Aion-gold-083.aspx
http://www.cheap-gamegold.org
http://www.gamegoldvip.org

Posted by aion gold on June 25, 2009 at 04:41 AM IST #

Nice information & code.
Thanks

Posted by SEO India on July 04, 2009 at 10:03 AM IST #

http://www.binbango.com/?p=328037

Posted by registrate on August 20, 2009 at 08:13 PM IST #

Hi,
I'm getting this error when i try to run the JNLP file of any application.I'm Using javaFX 1.2 and have changed the codebase to point to my working directory.Can anyone help?

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: com/sun/javafx/runtime/Main
at com.sun.javafx.runtime.main.Main.main(Main.java:35)
... 9 more
Caused by: java.lang.ClassNotFoundException: com.sun.javafx.runtime.Main
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 10 more

Posted by shilpa on August 21, 2009 at 05:53 AM IST #

www.jsjyyb.cn

Posted by 涡街流量计 on September 27, 2009 at 06:52 AM IST #

http://www.shanghaimassages.net

Posted by shanghai massage on September 27, 2009 at 06:53 AM IST #

By the way, if you are interested in high qualities but low price replica watches,Please contact us via our website http://www.progiftstore.com/.

Posted by progiftstore on October 12, 2009 at 05:59 AM IST #

Excellent work every buddy can get lots of interesting information, keep on posting this type of brilliant articles.

_____________
my sites:
http://allmp3store.com
http://mp3casette.com
http://superpopki.com
http://showmebikini.com
http://vseznaem.com

Posted by superpopki.com - Downloads legal mp3 music on October 23, 2009 at 09:21 AM IST #

It was a very nice idea! Just wanna say thank you for the information you have shared. Just continue writing this kind of post. I will be your loyal reader. Thanks again.

Posted by Christian Louboutin Boots on October 29, 2009 at 12:51 AM IST #

thanks Christian !

Posted by Vaibhav on October 29, 2009 at 05:14 AM IST #

solar street lights

Posted by solar street lights on October 30, 2009 at 01:36 AM IST #

I really believe that these social networks will have a huge impact on what we can accomplish as groups, it'll help us be very organized and communicate.

Posted by ed hardy clothing on November 11, 2009 at 02:12 AM IST #

yeah ,i think so

Posted by christian louboutin on November 15, 2009 at 04:36 AM IST #

I think I will try to recommend this post to my friends and family, cuz it’s really helpful.

Posted by ed hardy purses on November 16, 2009 at 11:00 PM IST #

Keep up the good work bro.Your article is really great and I truly enjoyed reading it.Waiting for some more great articles like this from you in the coming days.

Posted by Abercrombie and Fitch on December 10, 2009 at 05:34 AM IST #

<a href="http://www.163.com"rs>sleep</a>

[url=http://www.126.com/]sleep[/url]

Posted by sdfdfg on December 16, 2009 at 06:00 AM IST #

The code is awesome. We're trying to build an app for a community of diabetics.. this could come handy...

Posted by diabetes on December 18, 2009 at 12:31 PM IST #

We adopted some cool ideas from this code in one of our desktop web conferencing tools... it automatically checks out the user's location and then points it on the map... next is telepresence...

Posted by telepresence on December 18, 2009 at 10:36 PM IST #

Nice effort Vaibhav..the code is simple and easy to understand...

Posted by chemo on December 20, 2009 at 05:07 AM IST #

very creatively coded... good post!

Posted by allergy treatment on December 22, 2009 at 09:14 AM IST #

I think I will try to recommend this post to my friends and family, cuz it’s really helpful.

Posted by Christian Louboutin on December 23, 2009 at 10:53 PM IST #

Thank you for the sensible critique. Me & my neighbour were preparing to do some research about that. We got a good book on that matter from our local library and most books where not as influensive as your information. I am very glad to see such information which I was searching for a long time.This made very glad Smile

Posted by Christian Louboutin shoes on December 28, 2009 at 04:52 AM IST #

[L=Artis]http://blogs.sun.com[/L]

Posted by Lindatan on December 30, 2009 at 08:01 AM IST #

Just one question: how to add you blog into my rrs reader, thanks so much.

Posted by christian louboutin on January 03, 2010 at 12:42 AM IST #

I was very pleased to find this site.I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post.
regards,

Posted by Christian Louboutin shoes on January 04, 2010 at 09:37 AM IST #

I think I will try to recommend this post to my friends and family, cuz it’s really helpful.

Posted by christian louboutin on January 06, 2010 at 12:36 AM IST #

It was a very nice idea! Just wanna say thank you for the information you have shared. Just continue writing this kind of post. I will be your loyal reader. Thanks again.

Posted by christian louboutin on January 07, 2010 at 04:10 AM IST #

I think I will try to recommend this post to my friends and family, cuz it’s really helpful.

Posted by christian louboutin on January 08, 2010 at 12:34 AM IST #

This is great news. Best of luck for the future and keep up the good work.

Posted by China Wholesale on January 09, 2010 at 04:41 AM IST #

Thank you.Hot Shoes Cheap Jordan shoes michael jordan shoes and are on sale-Free shipping.

Posted by michael jordan shoes on January 10, 2010 at 11:17 PM IST #

Thank you for the sensible critique. Me & my neighbour were preparing to do some research about that. We got a good book on that matter from local library and most books where not as influensive as your information. I am very glad to see such information which I was searching for a long time.This made very glad Smile..

Posted by christian louboutin on January 13, 2010 at 01:18 AM IST #

Good information!

Posted by Abercrombie and Fitch on January 13, 2010 at 02:46 AM IST #

I will make sure and bookmark this page, I will come back to follow you more.

Posted by lazy boy kids furniture on January 21, 2010 at 06:31 PM IST #

The United States Christian Louboutin Shoes

Corporation today announced results for the first quarter of fiscal

Posted by Christian Louboutin shoes on January 25, 2010 at 08:56 AM IST #

<a href=" http://www.bestreplicarolexwatches.com"><strong>rolex replica</strong></a>,authentic quality. Many people are attractive by them.

Posted by rolex replica on February 05, 2010 at 05:34 AM IST #

Great post, thanks for it!

Posted by iPhone on February 08, 2010 at 09:25 PM IST #

My only complaint about the production is the handling of the chorus.

Posted by jordan shoes on February 26, 2010 at 10:42 PM IST #

thanks you very very much love real admin and boss thankss.. :D

Posted by parça kontör on March 16, 2010 at 04:10 PM IST #

Post a Comment:
Comments are closed for this entry.
About

Hi, I am Vaibhav Choudhary working in Sun. This blog is all about simple concept of Java and JavaFX.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today