Professional Documents
Culture Documents
Asayel Q Assignment
Asayel Q Assignment
JAZAN UNIVERSITY
ACADEMIC YEAR – 2023-24, 1st Semester
Assignment 1 - 004Comp-3 - Elective - 2 [2x5=10 Marks]
Instructions -
1) Solve all of the Questions and Submit/Upload on the Blackboard.
2) You have 1 week to submit your Assignments. The Last date of submission is on 05/10/23 M.
Q.-1 Design any one JForm (without coding) with topic relevant components (Java
NetBeans) from the followings list -
Tourism Information system
Car Rental Information System
Airline Information System
Courier Information System
Hospital management System
Hotel Room Reservation System
Student Information System
Health Care System
Sales Management System
Airline Information System
Banking Information System
Receipt Generator
Course Information System
Library Information System
Q.-2 Describe the Model-View-Design pattern of the Dynamic Web Application.
Q.-3 Design a Login Screen with User ID & Password in Java NetBeans. Also write the
coding to enter into the login.
Certainly! Here's a design for a login screen with a User ID and Password field in Java
NetBeans, along with the code to handle the login functionality:
Design:
1. JLabel: "Login"
- This label serves as the title of the login screen.
4. JLabel: "Password:"
- This label indicates the input field for the password.
5. JPasswordField: [Password Input Field]
- This password field allows the user to enter their password.
6. JButton: "Login"
- This button triggers the login functionality.
7. JButton: "Cancel"
- This button cancels the login process.
Code:
Here's an example code snippet that demonstrates the design and login functionality for the login
screen:
```java
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public LoginScreen() {
// Set up the frame
setTitle("Login Screen");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new FlowLayout());
// Initialize components
titleLabel = new JLabel("Login");
userIdLabel = new JLabel("User ID:");
userIdField = new JTextField(15);
passwordLabel = new JLabel("Password:");
passwordField = new JPasswordField(15);
loginButton = new JButton("Login");
cancelButton = new JButton("Cancel");
In the code, the login functionality is implemented inside the action listener for the login button.
The user ID and password entered by the user are retrieved from the corresponding fields. In this
example, the user ID is set to "admin" and the password is set to "password" for demonstration
purposes. You can modify these values or implement further logic to validate the user ID and
password against a database or other authentication mechanisms.
If the user ID and password match the expected values, a success message is displayed using a
JOptionPane. Otherwise, an error message is displayed.
Please note that this code only demonstrates the login screen design and basic functionality. In a
real-world application, you would need to implement appropriate security measures and handle
user authentication securely.