0% found this document useful (0 votes)
8 views

sms-oop

The document is a Java program that creates a graphical user interface for a Student Management System using Swing. It includes panels for managing student information, displaying admin details, and providing search functionality, along with a table to display student data. The layout consists of a north panel for the title, a west panel for admin information, a center panel for managing students, an east panel for search options, and a south panel for additional information about the system.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

sms-oop

The document is a Java program that creates a graphical user interface for a Student Management System using Swing. It includes panels for managing student information, displaying admin details, and providing search functionality, along with a table to display student data. The layout consists of a north panel for the title, a west panel for admin information, a center panel for managing students, an east panel for search options, and a south panel for additional information about the system.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

package studentmanagementsystem;

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import javax.swing.table.DefaultTableModel;

public class StudentManagementSystem {

public static void main(String[] args) {

JFrame frame = new JFrame();

frame.setLayout(new BorderLayout(1,1));

frame.setTitle("STUDENT MANAGEMENT SYSTEM");

frame.setVisible(true);

frame.setSize(900, 600);

frame.setResizable(false);

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

ImageIcon image1 = new


ImageIcon("C:/Users/jenni/Documents/NetBeansProjects/Swing/src/gui.jpg");

frame.setIconImage(image1.getImage());

ImageIcon image2= new


ImageIcon("C:/Users/jenni/Documents/NetBeansProjects/StudentManagementSystem/src/admin.jpg");

Image getIcon = image2.getImage();

Image resizeIcon = getIcon.getScaledInstance(30, 30, Image.SCALE_SMOOTH);

ImageIcon newImage = new ImageIcon(resizeIcon);


JLabel label1 = new JLabel();

label1.setText("STUDENT MANAGEMENT SYSTEM");

label1.setFont(new Font("Times new Roman", Font.BOLD, 22));

label1.setForeground(Color.WHITE);

JPanel north = new JPanel();

north.setVisible(true);

north.setBackground(Color.DARK_GRAY);

north.setPreferredSize(new Dimension(900,70));

north.add(label1);

JLabel admin = new JLabel();

admin.setText("ADMIN");

admin.setFont(new Font("Times new Roman", Font.BOLD, 18));

admin.setForeground(Color.BLACK);

JLabel admin1 = new JLabel();

admin1.setText("admin 1");

admin1.setFont(new Font("Times new Roman", Font.BOLD, 16));

admin1.setBackground(Color.WHITE);

admin1.setOpaque(true);

admin1.setForeground(Color.BLACK);

admin1.setIcon(newImage);

admin1.setPreferredSize(new Dimension (110,30));

JLabel admin2 = new JLabel();


admin2.setText("admin 2");

admin2.setFont(new Font("Times new Roman", Font.BOLD, 16));

admin2.setBackground(Color.WHITE);

admin2.setOpaque(true);

admin2.setForeground(Color.BLACK);

admin2.setIcon(newImage);

admin2.setPreferredSize(new Dimension (110,30));

JLabel admin3 = new JLabel();

admin3.setText("admin 3");

admin3.setFont(new Font("Times new Roman", Font.BOLD, 16));

admin3.setBackground(Color.WHITE);

admin3.setOpaque(true);

admin3.setForeground(Color.BLACK);

admin3.setIcon(newImage);

admin3.setPreferredSize(new Dimension (110,30));

JLabel admin4 = new JLabel();

admin4.setText("admin 4");

admin4.setFont(new Font("Times new Roman", Font.BOLD, 16));

admin4.setBackground(Color.WHITE);

admin4.setOpaque(true);

admin4.setForeground(Color.BLACK);

admin4.setIcon(newImage);

admin4.setPreferredSize(new Dimension (110,30));

JLabel admin5 = new JLabel();

admin5.setText("admin 5");

admin5.setFont(new Font("Times new Roman", Font.BOLD, 16));


admin5.setBackground(Color.WHITE);

admin5.setOpaque(true);

admin5.setForeground(Color.BLACK);

admin5.setIcon(newImage);

admin5.setPreferredSize(new Dimension (110,30));

JPanel west = new JPanel();

west.setVisible(true);

west.setBackground(Color.GRAY);

west.setPreferredSize(new Dimension(150, 460));

west.add(admin);

west.add(admin1);

west.add(admin2);

west.add(admin3);

west.add(admin4);

west.add(admin5);

JLabel manageStudent = new JLabel();

manageStudent.setText("MANAGE STUDENT");

manageStudent.setFont(new Font("Times new Roman", Font.BOLD, 18));

manageStudent.setForeground(Color.BLACK);

JLabel label2 = new JLabel("Name:");

JLabel label3 = new JLabel("ID number:");

JLabel label4 = new JLabel("Department:");

JLabel label5 = new JLabel("Gender: ");


JLabel label6 = new JLabel("Date:");

JLabel label7 = new JLabel("Label:");

JTextField name = new JTextField();

name.setPreferredSize(new Dimension(200,30));

JTextField id = new JTextField();

id.setPreferredSize(new Dimension(200,30));

String [] department = {"FACET","FALS","FBM","FNAHS","FHUSOCOM"};

JComboBox comBox = new JComboBox(department);

comBox.setPreferredSize(new Dimension(200,30));

String [] week = {"Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};

SpinnerListModel spinner = new SpinnerListModel(week);

JSpinner model = new JSpinner(spinner);

model.setPreferredSize(new Dimension(200,30));

JRadioButton male = new JRadioButton();

JRadioButton female = new JRadioButton();

male.setText("Male");

male.setBackground(Color.GRAY);

male.setFocusable(false);

female.setText("Female");

female.setBackground(Color.GRAY);

female.setFocusable(false);
ButtonGroup group1 = new ButtonGroup();

group1.add(male);

group1.add(female);

JPanel a = new JPanel();

a.setLayout(new BorderLayout());

a.setBackground(Color.GRAY);

a.setPreferredSize(new Dimension(300,30));

a.add(label2, BorderLayout.WEST);

a.add(name,BorderLayout.EAST );

JPanel b2 = new JPanel();

b2.setLayout(new BorderLayout());

b2.setBackground(Color.GRAY);

b2.setPreferredSize(new Dimension(300,30));

b2.add(label3, BorderLayout.WEST);

b2.add(id, BorderLayout.EAST);

JPanel c = new JPanel();

c.setLayout(new BorderLayout());

c.setBackground(Color.GRAY);

c.setPreferredSize(new Dimension(300,30));

c.add(label4, BorderLayout.WEST);

c.add(comBox, BorderLayout.EAST);

JPanel d = new JPanel();

d.setLayout(new GridLayout(1,3));

d.setBackground(Color.GRAY);

d.setPreferredSize(new Dimension(300,30));
d.add(label5 );

d.add(male);

d.add(female);

JPanel e = new JPanel();

e.setLayout(new BorderLayout());

e.setBackground(Color.GRAY);

e.setPreferredSize(new Dimension(300,30));

e.add(label6, BorderLayout.WEST);

e.add(model, BorderLayout.EAST);

JPanel e1 = new JPanel();

e1.setLayout(new BorderLayout());

e1.setBackground(Color.GRAY);

e1.setPreferredSize(new Dimension(300,30));

e1.add(label7, BorderLayout.WEST);

JPanel e2 = new JPanel();

e2.setLayout(new BorderLayout());

e2.setBackground(Color.WHITE);

e2.setPreferredSize(new Dimension(300,160));

JPanel center = new JPanel();

center.setVisible(true);

center.setBackground(Color.GRAY);

center.setPreferredSize(new Dimension(350,460));

center.add(manageStudent, BorderLayout.NORTH);

center.add(a);
center.add(b2);

center.add(c);

center.add(d);

center.add(e);

center.add(e1);

center.add(e2);

JLabel label = new JLabel();

label.setText("Search");

label.setFont(new Font("Times new Roman", Font.BOLD, 16));

label.setForeground(Color.BLACK);

JTextField search = new JTextField();

search.setPreferredSize(new Dimension(220,30));

JButton b = new JButton("Search");

b.setFocusable(false);

b.setPreferredSize(new Dimension(80,30));

b.addActionListener(new ActionListener () {

public void actionPerformed(ActionEvent e) {

System.out.println(search.getText());

});

JButton add = new JButton("ADD");

add.setPreferredSize(new Dimension(100,30));

add.setFocusable(false);

String [] head ={"ID","LN","FN","MN","COU","YEAR","ACTION"};


Object[][] rows = new Object [100][7];

DefaultTableModel mode = new DefaultTableModel (rows, head);

JTable table = new JTable(mode);

JScrollPane scrollPane = new JScrollPane(table);

JLabel page = new JLabel();

page.setText("Page 1 of 10");

page.setFont(new Font("Times new Roman", Font.BOLD, 16));

page.setForeground(Color.BLACK);

page.setHorizontalAlignment(JLabel.CENTER);

JButton prev = new JButton("Prev");

prev.setFocusable(false);

prev.setPreferredSize(new Dimension(100,30));

JButton next = new JButton("Next");

next.setFocusable(false);

next.setPreferredSize(new Dimension(100,30));

JPanel f = new JPanel();

f.setLayout(new BorderLayout());

f.setBackground(Color.GRAY);

f.setPreferredSize(new Dimension(360,30));

f.add(add, BorderLayout.WEST);

JPanel g = new JPanel();

g.setLayout(new BorderLayout());

g.setBackground(Color.GRAY);
g.setPreferredSize(new Dimension(360,280));

g.add(scrollPane);

JPanel h = new JPanel();

h.setLayout(new BorderLayout());

h.setBackground(Color.GRAY);

h.setPreferredSize(new Dimension(360,30));

h.add(prev, BorderLayout.WEST);

h.add(page,BorderLayout.CENTER);

h.add(next, BorderLayout.EAST);

JPanel east = new JPanel();

east.setVisible(true);

east.setBackground(Color.GRAY);

east.setPreferredSize(new Dimension(400,460));

east.add(label);

east.add(search);

east.add(b);

east.add(f);

east.add(g);

east.add(h);

JPanel south = new JPanel();

south.setVisible(true);

south.setForeground(Color.GRAY);

south.setPreferredSize(new Dimension(900,70));

south.setLayout(new BorderLayout(2,0));
// ------------------INSIDE SOUTH PANEL--------------------------

JLabel aboutUs = new JLabel();

aboutUs.setText("ABOUT US");

aboutUs.setFont(new Font("Times new Roman", Font.BOLD, 16));

aboutUs.setForeground(Color.BLACK);

JLabel services = new JLabel();

services.setText("OUR SERVICES");

services.setFont(new Font("Times new Roman", Font.BOLD, 16));

services.setForeground(Color.BLACK);

JLabel contacts = new JLabel();

contacts.setText("CONTACT US");

contacts.setFont(new Font("Times new Roman", Font.BOLD, 16));

contacts.setForeground(Color.BLACK);

ImageIcon facebook = new


ImageIcon("C:/Users/jenni/Documents/NetBeansProjects/StudentManagementSystem/src/
facebook.png");

ImageIcon gmail = new


ImageIcon("C:/Users/jenni/Documents/NetBeansProjects/StudentManagementSystem/src/gmail.png");

Image getIcon2 = facebook.getImage();

Image resizeIcon2 = getIcon2.getScaledInstance(10, 10, Image.SCALE_SMOOTH);


ImageIcon newImage2 = new ImageIcon(resizeIcon2);

Image getIcon3 = gmail.getImage();

Image resizeIcon3 = getIcon3.getScaledInstance(10, 10, Image.SCALE_SMOOTH);

ImageIcon newImage3 = new ImageIcon(resizeIcon3);

JPanel southWest = new JPanel();

JPanel southCenter = new JPanel();

JPanel southEast = new JPanel();

southWest.setBackground(Color.LIGHT_GRAY);

southCenter.setBackground(Color.LIGHT_GRAY);

southEast.setBackground(Color.LIGHT_GRAY);

southWest.setPreferredSize(new Dimension(300,70));

southCenter.setPreferredSize(new Dimension(300,70));

southEast.setPreferredSize(new Dimension(300,70));

JLabel contact1 = new JLabel();

contact1.setText("AJ Gonzales");

contact1.setForeground(Color.WHITE);

contact1.setIcon(newImage2);

JLabel contact2 = new JLabel();

contact2.setText("ajbrineg@gmail.com");

contact2.setForeground(Color.WHITE);

contact2.setIcon(newImage3);
JPanel Contact = new JPanel();

Contact.setLayout(new BorderLayout());

Contact.setBackground(Color.LIGHT_GRAY);

Contact.setPreferredSize(new Dimension(250,30));

Contact.add(contact1, BorderLayout.NORTH);

Contact.add(contact2, BorderLayout.SOUTH);

JLabel service1 = new JLabel("Student Enrollment & Admissions");

service1.setForeground(Color.WHITE);

JLabel service2 = new JLabel("Student Information Management");

service2.setForeground(Color.WHITE);

JLabel about = new JLabel(" We provide streamlined, secure student data ");

about.setForeground(Color.WHITE);

JLabel about1 = new JLabel("management solutions for educational institutions.");

about1.setForeground(Color.WHITE);

southWest.add(aboutUs);

southWest.add(about);

southWest.add(about1);

southCenter.add(services);

southCenter.add(service1);

southCenter.add(service2);

southEast.add(contacts);

southEast.add(Contact);
south.add(southWest,BorderLayout.WEST);

south.add(southCenter,BorderLayout.CENTER);

south.add(southEast,BorderLayout.EAST);

//----------------------------------------------

frame.add(north,BorderLayout.NORTH);

frame.add(west,BorderLayout.WEST);

frame.add(east,BorderLayout.EAST);

frame.add(center,BorderLayout.CENTER);

frame.add(south,BorderLayout.SOUTH);

frame.setVisible(true);

You might also like