Get the Weather with this Java App

This slideshow requires JavaScript.

My latest creation will show you the weather in your current location using your public ip, or you can enter a zip code and it will return the forecast for that location.

I used a variety of tools including:

Let’s go through the logic as briefly as possible.

  • Get current location using the IP API via the user’s ip address
  • From the location results, extract the latitude and longitude in xml format
  • Use this latitude and longitude to run a weather api request also in xml
  • Extract information, including the forecast for the next five days
  • Display information on the gui.
  • If user enters a zip code, do same as above but with zip code

The project includes three classes, WeatherApp, WeatherUtility, and Forecast.

  • WeatherApp holds the gui jform as well as the main method.
  • WeatherUtility is where all the work is done.
  • Forecast is used to create an object of each of the results obtained from the weather api.

View the source files on Github.

Download the app from http://natrivera.com/WeatherApp.jar

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s