WeatherApp is an intuitive platform designed to provide real-time weather data. It allows users to search for any location and instantly view its current weather, including temperature, humidity, windspeed, and weather condition. With the use of dynamic visuals, the app makes weather data easy to understand, enhancing your everyday planning.
- Location Search: Users can search for any location by name (e.g., Tokyo, New York).
- Real-time Weather Data: Displays temperature, humidity, wind speed, and weather condition based on the current time.
- Dynamic Weather Visuals: Visuals that change based on the weather condition (Clear, Cloudy, Rain, Snow).
- User-friendly GUI: Simple and clear interface built using Java Swing.
- Java: Core programming language.
- Swing: GUI framework for building the user interface.
- Open-Meteo API: API for fetching real-time weather data.
- JSON Simple: For parsing and handling JSON data from APIs.
-
Clone the repository:
git clone https://github.com/yourusername/WeatherApp.git cd WeatherApp
-
Install dependencies (If needed, add any dependencies in a specific section here).
-
Run the application:
- Compile the Java files:
javac *.java
- Run the application:
java AppLauncher
- Compile the Java files:
- Open the application.
- Enter a location name (e.g., "London") in the search bar.
- Click the search button to fetch and display real-time weather data for that location.
- The app will show the temperature, weather condition, humidity, and wind speed.
- Weather images will dynamically change based on the current weather condition.
- Purpose: Entry point of the application. It launches the
WeatherAppGui
interface.
- Purpose: Handles the backend logic of fetching weather data from the Open-Meteo API using the location name.
- Methods:
getWeatherData(String locationName)
: Fetches weather data based on location coordinates.getLocationData(String locationName)
: Fetches location coordinates from the geolocation API.fetchApiResponse(String urlString)
: Makes an HTTP GET request to fetch data from the API.
- Purpose: Manages the graphical user interface (GUI) for displaying weather information.
- Components:
- Search Bar: For entering location names.
- Weather Condition Image: Dynamically updates based on weather condition.
- Temperature: Displays current temperature in Celsius.
- Humidity & Windspeed: Displays current humidity and windspeed data.
- Search Button: Triggers the weather data retrieval when clicked.
- Error Handling: Improved error messages and better handling for invalid input.
- Geolocation: Automatically detect user location for weather data.
- Additional Data: Display extended weather forecast (e.g., 7-day forecast).
Distributed under the MIT License. See LICENSE
for more information.