Swing Weather Worldclock

Remember the worldclock blogpost? Well it was ok but i thought there was one thing missing…

Weather information

For that reason i added this missing feature to the known worldclock component so that you now might choose out of four clocks:

  • Pure clock and icon indicator for time of day
  • Pure clock, icon indicator for time of day and weather information
  • Clock with inbuild time of day display
  • Clock with inbuild time of day display and weather information

This image shows all available clocks:

ishot-6.png

To get the weather information for all the cities in the enum i provide, i needed to add the country for each city and by adding all these countries i translated the cities to their (hopefully) right english names (in the original worldclock post i used german city names).

I use weather underground to retrieve the weather information because they provide an easy to access service for free. You will find a package called „net“ in the project in which i put the classes responsible for fetching the weather condition. There is timer which checks every 30 seconds for the availability of the connection.
The clockpanels will every 10 minutes add a so called ConditionFetcher thread to the queue of the WeatherService which will be handled by a ExecutorService. The WeatherService will tries to use the system proxy server if there is one so it hopefuly works out for you.

The most of the work was done by creating all the different weather condition images which you will see in the next image:

ishot-7.png

And of course we will have different images for the night (but only different if the moon is visible), here they are:

ishot-8.png

Additional to the current weather condition you will find the min and max temperature below the condition image and you could choose between degrees celsius or fahrenheit as temperature unit.

In the project you will find a package called „app“ and in this package you will find four classes called „Main1“, „Main2“, „Main3“, „Main4“. Each of these classes will start a different version of the worldclock with the four cities (Hong Kong, Berlin, New York, San Francisco) so if you are fine with the cities just select the right class as start class in the netbeans project properties and compile it. Otherwise change/add/remove the cities as you like.

Here are the four predefined worldclocks:

Main1.classishot-9.png
Main2.classishot-10.png
Main3.classishot-11.png
Main4.classishot-12.png

So that’s the weather worldtime clock and as always you will find the source as zipped netbeans project here.

By the way i’m still not satisfied with this version. I’m currently working on a different approach where i try to visualize the time of the day and combine it with weather and a clock but that project will take some more time to finish. Here is a little preview:

ishot-13.png

But that’s a different story…

Enjoy Java and follow me on twitter if you like…

 

3 thoughts to “Swing Weather Worldclock”

  1. I love the old rectangular map of the earth, with the sunlight wave centred in the middle, to indicate noon. If you could add weather to something like that: it would be ausgezeichnet!

  2. This is very good. But I could not hold my laugh at the weather informations like ‚NIGHT – Sunny‘, ‚NIGHT – Partly Sunny’… wow! this is a different world 🙂 I mean Sun and night don’t go together…

    I like your amazing work… Thank you.

Kommentare sind geschlossen.