Weather Management System 2024-2025
Report On Weather Management System in Java
[Link]:-
The Weather Management System is designed to provide real-time weather updates,
forecasts, and climate analysis. This system leverages core Java programming concepts to
structure the application efficiently. The Weather Management System is built using Java's
robust data structures to manage weather data, including temperature, humidity, wind speed,
and precipitation. By utilizing structured data handling techniques, the system ensures
accurate weather reporting, efficient data retrieval, and seamless user interaction for
accessing weather information.
[Link] Outcome(CO)–
o Develop java program for implementing event handling using window based
application components.
[Link] Review:-
Weather management systems are essential tools for monitoring climate conditions and
providing forecasts. Traditionally reliant on complex meteorological models, modern systems
now use APIs and graphical interfaces for real-time data visualization. Java, with its platform
independence and robust GUI capabilities via Swing, is well-suited for such applications.
While many weather apps are web-based, Java desktop applications offer better offline
usability and are ideal for educational and practical use. This project builds on these
foundations to simulate a user-friendly and interactive weather system using Java.
4. Methodology:
The Weather Management System application is developed using Java's GUI libraries
— primarily Swing and AWT (Abstract Window Toolkit) — along with basic Java
concepts such as classes, constructors, event handling, and random data generation.
Swing Components:
o The user interface is mainly built using Swing components, which are lightweight and
flexible tools for GUI development in Java.
o JFrame is used to create the main window and the weather display window. It acts as
the base container for adding other components.
o JLabel is used to display static or dynamic text on the screen. Labels are used to
show city names, weather information, date, and time.
o JTextField allows the user to manually type the name of a city if it's not in the
dropdown list.
o JButton components are used to provide interactivity. The "Get Weather", "Clear",
and "Exit" buttons let users fetch weather data, clear input, or exit the application
respectively.
Sharad Institute of Technology Polytechnic, Yadrav
5
Weather Management System 2024-2025
o JComboBox provides a dropdown menu of predefined city names that the user can
select from easily.
o ImageIcon is used to display weather-related icons like a sun or moon image based
on the time of the day.
AWT Classes and Utilities:
o Font class is used to style the text shown in labels by changing its size and making it
bold.
o Color class is used to customize the background and text colors, giving the
application a visually appealing look.
o setBounds(x, y, width, height) is used to manually position every GUI component
inside the frame, giving precise control over layout.
Methods and Constructors:
o The constructor WeatherManagementGUI1() initializes the main window, sets its
size and title, places the components (like buttons, text field, labels), and registers
action listeners.
o The constructor WeatherAppGUI(String city) takes a city name as an argument and
displays simulated weather information for that city, including temperature, humidity,
and date/time.
o actionPerformed(ActionEvent e) is the main method responsible for handling user
interaction. It checks which button is clicked and responds accordingly — either
opening the weather display window, clearing text input, or exiting the program.
Event Handling:
o The program uses the ActionListener interface to handle events such as button clicks.
o Every button is assigned an event using addActionListener(this), and when the
button is clicked, the actionPerformed method is triggered.
o This event-handling mechanism ensures that the app responds to user commands
smoothly.
Utility Classes:
o Random class is used to generate simulated temperature, humidity, latitude, and
longitude values so that the system behaves like a real-time weather application
without needing internet access or APIs.
o SimpleDateFormat and Date classes are used to format and display the current date
and time on the weather screen.
o [Link]().getHour() determines whether it is day or night and helps in
dynamically changing the weather icon accordingly.
Sharad Institute of Technology Polytechnic, Yadrav
5
Weather Management System 2024-2025
[Link] Required:-
Sr. Name of Resources
Specification
no
Computer System Processor: i5
1 RAM: 8 GB
Operating System Windows 11
2
Development Software Notepad, Java Developmant Kit(JDK)
3
[Link] code:-
import [Link].*;
import [Link].*;
import [Link].*;
import [Link];
import [Link];
import [Link];
import [Link];
public class WeatherManagementGUI1 extends JFrame implements ActionListener {
private JLabel titleLabel, cityLabel;
private JTextField cityTextField;
private JButton getWeatherButton, clearButton, exitButton;
private JComboBox<String> cityDropdown;
public WeatherManagementGUI1() { // Fix: Constructor name corrected
// Frame Settings
Sharad Institute of Technology Polytechnic, Yadrav
5
Weather Management System 2024-2025
setTitle("Weather Management System");
setSize(400, 250);
setLayout(null);
setDefaultCloseOperation(EXIT_ON_CLOSE);
getContentPane().setBackground(new Color(173, 216, 230));
// Title Label
titleLabel = new JLabel("Weather Management System", [Link]);
[Link](50, 20, 300, 30);
[Link](new Font("Arial", [Link], 16));
add(titleLabel);
// City Label
cityLabel = new JLabel("Select or Enter City:");
[Link](30, 70, 150, 25);
add(cityLabel);
// City Dropdown List
String[] cities = {"New York", "London", "Paris", "Tokyo", "Sydney",
"Delhi", "Mumbai", "Bangalore", "Kolkata", "Chennai"};
cityDropdown = new JComboBox<>(cities);
[Link](180, 70, 150, 25);
add(cityDropdown);
// City TextField
cityTextField = new JTextField();
Sharad Institute of Technology Polytechnic, Yadrav
5
Weather Management System 2024-2025
[Link](180, 100, 150, 25);
add(cityTextField);
// Buttons
getWeatherButton = new JButton("Get Weather");
[Link](30, 150, 120, 30);
[Link](this);
add(getWeatherButton);
clearButton = new JButton("Clear");
[Link](160, 150, 80, 30);
[Link](this);
add(clearButton);
exitButton = new JButton("Exit");
[Link](250, 150, 80, 30);
[Link](this);
add(exitButton);
setVisible(true);
// Handling Button Click Events
public void actionPerformed(ActionEvent e) {
if ([Link]() == getWeatherButton) {
String city = [Link]().trim();
if ([Link]()) {
Sharad Institute of Technology Polytechnic, Yadrav
5
Weather Management System 2024-2025
city = (String) [Link]();
new WeatherAppGUI(city); // Open WeatherAppGUI with selected city
else if ([Link]() == clearButton) {
[Link]("");
else if ([Link]() == exitButton) {
[Link](0);
public static void main(String[] args) {
new WeatherManagementGUI1(); // Fix: Constructor name matched
// ---------------------- WEATHER APP GUI ----------------------
class WeatherAppGUI extends JFrame {
private JLabel cityLabel, latLonLabel, dateTimeLabel, tempLabel, humidityLabel,
minMaxLabel, iconLabel, footerLabel;
public WeatherAppGUI(String city) {
setTitle("Weather App - " + city);
setSize(400, 500);
setLayout(null);
Sharad Institute of Technology Polytechnic, Yadrav
5
Weather Management System 2024-2025
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
getContentPane().setBackground([Link]);
// City and Country Label
cityLabel = new JLabel(city + " IN", [Link]);
[Link](50, 20, 300, 30);
[Link](new Font("Arial", [Link], 18));
add(cityLabel);
// Latitude & Longitude
Random rand = new Random();
double lat = [Link]() * (30 - 10) + 10;
double lon = [Link]() * (90 - 70) + 70;
latLonLabel = new JLabel([Link]("%.2f %.2f", lat, lon),
[Link]);
[Link](50, 50, 300, 25);
add(latLonLabel);
// Date & Time
SimpleDateFormat sdf = new SimpleDateFormat("EEEE - dd MMMM hh:mm a");
String dateTime = [Link](new Date());
dateTimeLabel = new JLabel(dateTime, [Link]);
[Link](50, 80, 300, 40);
add(dateTimeLabel);
// Temperature
int temperature = [Link](15) + 20; // Random temp between 20-35°C
Sharad Institute of Technology Polytechnic, Yadrav
5
Weather Management System 2024-2025
tempLabel = new JLabel(temperature + "°C", [Link]);
[Link](50, 130, 300, 100);
[Link](new Font("Arial", [Link], 50));
[Link]([Link]);
add(tempLabel);
// Humidity
int humidity = [Link](50) + 30;
humidityLabel = new JLabel("Humidity: " + humidity, [Link]);
[Link](50, 230, 300, 30);
add(humidityLabel);
// Min/Max Temperature
int minTemp = temperature - [Link](3);
int maxTemp = temperature + [Link](3);
minMaxLabel = new JLabel("Max: " + maxTemp + "°C | Min: " + minTemp + "°C",
[Link]);
[Link](50, 260, 300, 30);
add(minMaxLabel);
// Weather Icon
String iconPath = ([Link]().getHour() >= 18) ? "[Link]" : "[Link]";
ImageIcon weatherIcon = new ImageIcon(iconPath);
iconLabel = new JLabel(weatherIcon);
[Link](140, 300, 120, 100);
add(iconLabel)
setVisible(true);
Sharad Institute of Technology Polytechnic, Yadrav
5
Weather Management System 2024-2025
[Link] of Project:-
Sharad Institute of Technology Polytechnic, Yadrav
5
Weather Management System 2024-2025
Sharad Institute of Technology Polytechnic, Yadrav
5
Weather Management System 2024-2025
[Link]:-
1. Educational Tool
2. Smart City Planning
3. Agriculture
4. Disaster Preparedness
5. Travel Planning
6. Environmental Projects
7. IoT Integration Demo
[Link]:
The Weather Management System provides a user-friendly interface to access and display
weather-related information for various cities. Developed using Java Swing, it demonstrates
core concepts like GUI design, event handling, and real-time data simulation. This system is
useful for learning Java-based application development and serves as a base model for
integrating real-world weather APIs in the future. Overall, it effectively highlights how
technology can be leveraged for better environmental awareness and planning.
[Link]:
[Link]
[Link]
[Link]
Sharad Institute of Technology Polytechnic, Yadrav
5
Weather Management System 2024-2025
Sharad Institute of Technology Polytechnic, Yadrav
5
Weather Management System 2024-2025
1. References:-
Sharad Institute of Technology Polytechnic, Yadrav
5
Weather Management System 2024-2025
1 [Link]
2. [Link]
3. [Link]
Sharad Institute of Technology Polytechnic, Yadrav
5