Studentmanagwement
Studentmanagwement
*;
import java.awt.*;
import java.awt.event.*;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.util.Stack;
import java.util.HashSet;
class Student {
String name;
String rollNo;
int age;
String registrationDate;
this.name = name;
this.rollNo = rollNo;
this.age = age;
this.registrationDate = registrationDate;
@Override
return "Name: " + name + ", Roll No: " + rollNo + ", Age: " + age +
@Override
super.paintComponent(g);
public StudentManagementSystem() {
setSize(700, 600);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setResizable(false);
// Set the background panel as content pane
// Labels
Font boldFont = new Font("Arial", Font.BOLD, 14); // Example font with size 14
nameLabel.setFont(boldFont);
rollLabel.setFont(boldFont);
ageLabel.setFont(boldFont);
// Buttons
// displayArea.setEditable(false);
JScrollPane scrollPane = new JScrollPane(displayArea);
// backgroundPanel.add(nameField); backgroundPanel.add(rollLabel);
// backgroundPanel.add(rollField); backgroundPanel.add(ageLabel);
// backgroundPanel.add(ageField); backgroundPanel.add(addButton);
// backgroundPanel.add(editButton); backgroundPanel.add(deleteButton);
// backgroundPanel.add(showButton); backgroundPanel.add(clearButton);
backgroundPanel.add(scrollPane);
// showButton.addActionListener(this); editButton.addActionListener(this);
// deleteButton.addActionListener(this);
clearButton.addActionListener(this);
// Set color #ffae42 (orange) for labels and their associated text boxes
nameLabel.setForeground(Color.decode("#ffed29"));
rollLabel.setForeground(Color.decode("#ffed29"));
ageLabel.setForeground(Color.decode("#ffed29"));
// rollField.setBackground(Color.WHITE); ageField.setBackground(Color.WHITE);
// Optional: You can also set the text color to contrast better with the
// background nameField.setForeground(Color.black);
// rollField.setForeground(Color.black); ageField.setForeground(Color.black);
// editButton.setBackground(Color.CYAN); deleteButton.setBackground(Color.RED);
// showButton.setBackground(Color.YELLOW);
displayArea.setBackground(Color.decode("#add8e6"));
displayArea.setForeground(Color.black);
@Override
if (rollNumbers.contains(rollNo)) {
return;
rollNumbers.add(rollNo);
nameField.setText("");
rollField.setText("");
ageField.setText("");
if (studentStack.isEmpty()) {
} else {
studentDetails.append(student.toString());
displayArea.setText(studentDetails.toString());
if (studentToEdit != null) {
studentToEdit.age));
studentToEdit.name = newName;
studentToEdit.age = newAge;
} else {
if (removed) {
} else {
if (student.rollNo.equals(rollNo)) {
return student;
}
return null;
while (!studentStack.isEmpty()) {
if (student.rollNo.equals(rollNo)) {
rollNumbers.remove(rollNo);
found = true;
break;
} else {
tempStack.push(student);
while (!tempStack.isEmpty()) {
studentStack.push(tempStack.pop());
return found;
// Create a new JFrame for displaying the image JFrame imageFrame = new
// JFrame("Welcome");
imageFrame.setSize(400, 300);
imageFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
imageFrame.setLayout(new BorderLayout());
imageFrame.add(label, BorderLayout.CENTER);
imageFrame.setVisible(true);
// Close the image frame after 3 seconds and open the main system window
@Override
sms.setVisible(true);
});
} else {
JOptionPane.ERROR_MESSAGE);