WeatherApp is a simple Java-based desktop application that provides current weather information for a specified location. The app fetches weather data from an external API, processes it, and displays the information on a graphical user interface (GUI) built with Swing.
- Search Functionality: Enter the name of a city or location to retrieve the current weather information.
- Weather Display: Shows the temperature, weather condition, humidity, and wind speed.
- Dynamic Weather Icons: Displays corresponding weather icons based on current conditions (Clear, Cloudy, Rain, Snow).
- Responsive Design: The application is designed to run smoothly on any desktop environment, with a fixed window size.
- Java Development Kit (JDK) 8 or higher
- Internet connection (to fetch weather data from the external API)
Clone the repository to your local machine using the following command:
- Open IntelliJ IDEA.
- Select Open and navigate to the cloned repository.
- Open the project.
- Ensure that all dependencies are properly configured.
- Build the project using the Build option in IntelliJ IDEA.
- Run the
AppLauncher
class to start the application.
- Enter the name of a city or location in the search bar.
- Click the search button (magnifying glass icon) to retrieve and display the current weather information.
This class serves as the entry point of the application. It initializes the GUI by invoking the WeatherAppGUI
class.
This class handles the graphical user interface (GUI) of the application. It includes:
- Components like text fields, labels, and buttons.
- Event listeners for user interactions.
- Methods to update the display based on weather data.
This class contains the backend logic for fetching and processing weather data. It includes:
- Methods to get location coordinates.
- API calls to fetch weather data.
- Parsing and processing the retrieved data.
- Helper methods to convert and format data.
- API Limits: Be aware of the rate limits imposed by the weather API being used. Frequent requests may lead to temporary blocks.
- Error Handling: The application includes basic error handling for API requests and invalid user inputs.
- Icons: You can replace the weather icons in the
src/assets/
directory with your own images, ensuring they have the same filenames. - API Endpoint: The application currently uses the Open-Meteo API. You can modify the
WeatherApp.java
file to use a different API by changing the URLs and parsing logic accordingly.
- API Connection Issues: Ensure you have a stable internet connection. If the app fails to connect to the API, check if the API is accessible via a web browser.
- Invalid Location: If no weather data is displayed, verify the location name or try a different location.
Enjoy your weather updates with WeatherApp!