How do/can I use the information from Weather(Grabber) (I got it from importing a class in Greenfoot under the "Edit" menu)?
private WeatherGrabber weatherGrabber = new WeatherGrabber("Hello", "danpost");Exception in thread "Thread-63" java.lang.RuntimeException: Can not find weather information for Paris, France. Please check spelling or try another location at weather.util.WeatherGrabber.getWeatherStation(WeatherGrabber.java:102) at weather.util.WeatherGrabber.fetchData(WeatherGrabber.java:69) at weather.util.WeatherGrabber.access$000(WeatherGrabber.java:20) at weather.util.WeatherGrabber$1.run(WeatherGrabber.java:62) at java.lang.Thread.run(Thread.java:745) java.lang.RuntimeException: Can not find weather information for Paris, France. Operation timed out. at weather.util.WeatherGrabber.getDataset(WeatherGrabber.java:117) at Weather.getTemperature(Weather.java:72) at WeatherQuery.exampleMethod(WeatherQuery.java:24) at WeatherQuery.act(WeatherQuery.java:19) at greenfoot.core.Simulation.actActor(Simulation.java:604) at greenfoot.core.Simulation.runOneLoop(Simulation.java:562) at greenfoot.core.Simulation.runContent(Simulation.java:221) at greenfoot.core.Simulation.run(Simulation.java:211)
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class WeatherQuery here.
*
* @author amjad
* @version 2.0
*/
public class WeatherQuery extends Actor
{
private Weather weather = new Weather("France", "Paris");
/**
* Act - do whatever the WeatherQuery wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
exampleMethod();
}
public void exampleMethod()
{
double temperature = weather.getTemperature();
String windDirection = weather.getWindDirection();
int humidity = weather.getHumidity();
//System.out.println("The current temperature in " + weather.getCity() + " is " + temperature + " degrees");
setImage(new GreenfootImage("The current temperature in " + weather.getCity() + " is " + temperature + " degrees", 14, null, null));
}
}