├── .gitignore
├── .vscode
└── settings.json
├── src
├── resources
│ ├── add.png
│ ├── edit.png
│ ├── logo.png
│ ├── assign.png
│ ├── courses.png
│ ├── remove.png
│ ├── student.png
│ ├── teacher.png
│ ├── settings.png
│ ├── login_image.png
│ ├── logo_round.png
│ ├── search_icon.png
│ ├── signup_image.png
│ ├── password_eye_hide.png
│ └── password_eye_show.png
├── models
│ ├── user
│ │ ├── Admin.java
│ │ ├── SystemUser.java
│ │ ├── Teacher.java
│ │ └── Student.java
│ └── course
│ │ ├── Module.java
│ │ └── Course.java
├── exceptions
│ ├── InvalidEmailException.java
│ └── InvalidPasswordException.java
├── util
│ ├── CustomImage.java
│ ├── Validator.java
│ ├── CellRenderer.java
│ ├── DatabaseManager.java
│ ├── DataRetriever.java
│ └── DataManager.java
├── pages
│ ├── SplashScreen.java
│ ├── Login.java
│ ├── Courses.java
│ ├── SignUp.java
│ ├── Students.java
│ ├── Teachers.java
│ └── Dashboard.java
├── App.java
└── auth
│ └── Auth.java
├── External_JARS
└── mysql-connector-j-8.0.32.jar
├── .classpath
├── .project
├── README.md
└── UML_Diagram.ucls
/.gitignore:
--------------------------------------------------------------------------------
1 | *class
2 | .settings
3 | bin/
4 | gen/
5 | out/
6 | .DS_Store
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "java.debug.settings.onBuildFailureProceed": true
3 | }
4 |
--------------------------------------------------------------------------------
/src/resources/add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R0shish/Course-Management-System/HEAD/src/resources/add.png
--------------------------------------------------------------------------------
/src/resources/edit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R0shish/Course-Management-System/HEAD/src/resources/edit.png
--------------------------------------------------------------------------------
/src/resources/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R0shish/Course-Management-System/HEAD/src/resources/logo.png
--------------------------------------------------------------------------------
/src/resources/assign.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R0shish/Course-Management-System/HEAD/src/resources/assign.png
--------------------------------------------------------------------------------
/src/resources/courses.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R0shish/Course-Management-System/HEAD/src/resources/courses.png
--------------------------------------------------------------------------------
/src/resources/remove.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R0shish/Course-Management-System/HEAD/src/resources/remove.png
--------------------------------------------------------------------------------
/src/resources/student.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R0shish/Course-Management-System/HEAD/src/resources/student.png
--------------------------------------------------------------------------------
/src/resources/teacher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R0shish/Course-Management-System/HEAD/src/resources/teacher.png
--------------------------------------------------------------------------------
/src/resources/settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R0shish/Course-Management-System/HEAD/src/resources/settings.png
--------------------------------------------------------------------------------
/src/resources/login_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R0shish/Course-Management-System/HEAD/src/resources/login_image.png
--------------------------------------------------------------------------------
/src/resources/logo_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R0shish/Course-Management-System/HEAD/src/resources/logo_round.png
--------------------------------------------------------------------------------
/src/resources/search_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R0shish/Course-Management-System/HEAD/src/resources/search_icon.png
--------------------------------------------------------------------------------
/src/resources/signup_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R0shish/Course-Management-System/HEAD/src/resources/signup_image.png
--------------------------------------------------------------------------------
/src/resources/password_eye_hide.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R0shish/Course-Management-System/HEAD/src/resources/password_eye_hide.png
--------------------------------------------------------------------------------
/src/resources/password_eye_show.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R0shish/Course-Management-System/HEAD/src/resources/password_eye_show.png
--------------------------------------------------------------------------------
/External_JARS/mysql-connector-j-8.0.32.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/R0shish/Course-Management-System/HEAD/External_JARS/mysql-connector-j-8.0.32.jar
--------------------------------------------------------------------------------
/src/models/user/Admin.java:
--------------------------------------------------------------------------------
1 | package models.user;
2 |
3 | public class Admin extends SystemUser {
4 |
5 | public Admin(String name) {
6 | super(name, "Admin");
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/exceptions/InvalidEmailException.java:
--------------------------------------------------------------------------------
1 | package exceptions;
2 |
3 | public class InvalidEmailException extends Exception {
4 |
5 | private static final long serialVersionUID = -8145316108548232390L;
6 |
7 | public InvalidEmailException(String message) {
8 | super(message);
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/exceptions/InvalidPasswordException.java:
--------------------------------------------------------------------------------
1 | package exceptions;
2 |
3 | public class InvalidPasswordException extends Exception {
4 |
5 | private static final long serialVersionUID = 3761449227809409477L;
6 |
7 | public InvalidPasswordException(String message) {
8 | super(message);
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/models/user/SystemUser.java:
--------------------------------------------------------------------------------
1 | package models.user;
2 |
3 | public class SystemUser {
4 | private String name;
5 | private String role;
6 |
7 | public SystemUser(String name, String role) {
8 | this.name = name;
9 | this.role = role;
10 | }
11 |
12 | public String getName() {
13 | return name;
14 | }
15 |
16 | public String getRole() {
17 | return role;
18 | }
19 |
20 | @Override
21 | public String toString() {
22 | return name;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/util/CustomImage.java:
--------------------------------------------------------------------------------
1 | package util;
2 |
3 | import javax.swing.ImageIcon;
4 | import javax.swing.JPanel;
5 |
6 | public class CustomImage extends JPanel {
7 |
8 | private static final long serialVersionUID = 4985367388576734702L;
9 | private ImageIcon image;
10 |
11 | public CustomImage(String path) {
12 | ImageIcon image = new ImageIcon(getClass().getResource(path));
13 | this.image = image;
14 | }
15 |
16 | public ImageIcon getImage(int width, int height) {
17 | return new ImageIcon(image.getImage().getScaledInstance(width, height, java.awt.Image.SCALE_SMOOTH));
18 | }
19 | }
--------------------------------------------------------------------------------
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/models/course/Module.java:
--------------------------------------------------------------------------------
1 | package models.course;
2 |
3 | public class Module {
4 | private int id;
5 | private String name;
6 | private String type;
7 |
8 | public Module(int id, String name, String type) {
9 | this.id = id;
10 | this.name = name;
11 | this.type = type;
12 | }
13 |
14 | public int getId() {
15 | return id;
16 | }
17 |
18 | public String getName() {
19 | return name;
20 | }
21 |
22 | public String getType() {
23 | return type;
24 | }
25 |
26 | public static Module fromSql(int id, String name, String type) {
27 | return new Module(id, name, type);
28 | }
29 |
30 | @Override
31 | public String toString() {
32 | return name;
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | course_management_system
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
19 | 1674297827780
20 |
21 | 30
22 |
23 | org.eclipse.core.resources.regexFilterMatcher
24 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/src/models/course/Course.java:
--------------------------------------------------------------------------------
1 | package models.course;
2 |
3 | import java.util.ArrayList;
4 |
5 | public class Course {
6 | private int id;
7 | private String name;
8 | private ArrayList modules;
9 |
10 | public Course(int id, String name) {
11 | this.id = id;
12 | this.name = name;
13 | }
14 |
15 | public int getId() {
16 | return id;
17 | }
18 |
19 | public String getName() {
20 | return name;
21 | }
22 |
23 | public ArrayList getModules() {
24 | return modules;
25 | }
26 |
27 | public String getModulesString() {
28 | String modulesString = "";
29 | for (Module module : modules) {
30 | modulesString += module.getName() + ", ";
31 | }
32 | return modulesString.substring(0, modulesString.length() - 2);
33 | }
34 |
35 | public void setModules(ArrayList modules) {
36 | this.modules = modules;
37 | }
38 |
39 | @Override
40 | public String toString() {
41 | return name;
42 | }
43 |
44 | public static Course fromSql(int id, String name) {
45 | return new Course(id, name);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Course Management System
2 | A simple Course Management System implemented using Java Swing and MYSQL database made for the final coursework of 5CS019 - Object-Oriented Design and Programming.
3 |
4 | ## Tools and Utilities
5 | - Java
6 | - Swing (UI)
7 | - MYSQL (Database)
8 |
9 | ## Screenshots
10 |
11 | #### Splash Screen
12 |
13 |
14 | #### Login Page
15 |
16 |
17 | #### Sign Up Page
18 |
19 |
20 |
21 | ## Contributing
22 | If you're interested in contributing to this project and making it better with new ideas, your pull request will be greatly appreciated.
23 |
24 | If you come across any problems, please let us know by posting in the issues section of the repository.
25 |
26 | Also, if you like the project, don't forget to give it a star. Thank you for your support.
27 |
--------------------------------------------------------------------------------
/src/util/Validator.java:
--------------------------------------------------------------------------------
1 | package util;
2 |
3 | import java.util.regex.Matcher;
4 | import java.util.regex.Pattern;
5 |
6 | import javax.swing.JLabel;
7 |
8 | public class Validator {
9 |
10 | public static boolean validate(String text, JLabel label, String field) {
11 | switch (field) {
12 | case "Email":
13 | String regex = "^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$";
14 | Pattern pattern = Pattern.compile(regex);
15 | Matcher matcher = pattern.matcher(text);
16 | if (!matcher.matches()) {
17 | label.setText("Invalid " + field.toLowerCase() + "!");
18 | return false;
19 | }
20 | label.setText("");
21 | return true;
22 | case "Password":
23 | if (text.length() < 8) {
24 | label.setText(field + " must be atleast 8 characters long!");
25 | return false;
26 | }
27 | if (!text.matches(".*\\d+.*")) {
28 | label.setText(field + " must have atleast one number!");
29 | return false;
30 | }
31 | label.setText("");
32 | return true;
33 |
34 | default:
35 | if (text.length() < 3) {
36 | label.setText("Invalid " + field.toLowerCase() + "!");
37 | return false;
38 | }
39 | label.setText("");
40 | return true;
41 | }
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/models/user/Teacher.java:
--------------------------------------------------------------------------------
1 | package models.user;
2 |
3 | import java.util.ArrayList;
4 | import models.course.Module;
5 |
6 | public class Teacher extends SystemUser {
7 | private int id;
8 | private String name;
9 | private String phone;
10 | private String email;
11 | private ArrayList modules;
12 |
13 | public Teacher(int id, String name, String phone, String email, ArrayList modules) {
14 | super(name, "Teacher");
15 | this.id = id;
16 | this.name = name;
17 | this.phone = phone;
18 | this.email = email;
19 | this.modules = modules;
20 | }
21 |
22 | public Teacher(String name) {
23 | super(name, "Teacher");
24 | }
25 |
26 | public static Teacher fromSql(int id, String name, String phone, String email, ArrayList modules) {
27 | return new Teacher(id, name, phone, email, modules);
28 | }
29 |
30 | public ArrayList getModules() {
31 | return modules;
32 | }
33 |
34 | public String getModuleString() {
35 | String moduleString = "";
36 | for (Module module : modules) {
37 | moduleString += module.getName() + ", ";
38 | }
39 | if (moduleString.length() < 3) {
40 | return "No modules";
41 | }
42 | return moduleString.substring(0, moduleString.length() - 2);
43 | }
44 |
45 | public int getId() {
46 | return id;
47 | }
48 |
49 | public String getName() {
50 | return name;
51 | }
52 |
53 | public String getPhone() {
54 | return phone;
55 | }
56 |
57 | public String getEmail() {
58 | return email;
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/src/pages/SplashScreen.java:
--------------------------------------------------------------------------------
1 | package pages;
2 |
3 | import java.awt.Color;
4 | import java.awt.event.ActionEvent;
5 | import java.awt.event.ActionListener;
6 |
7 | import javax.swing.JFrame;
8 | import javax.swing.JLabel;
9 | import javax.swing.JPanel;
10 | import javax.swing.JProgressBar;
11 | import javax.swing.Timer;
12 |
13 | import util.CustomImage;
14 |
15 | public class SplashScreen extends JPanel {
16 |
17 | private static final long serialVersionUID = -3421670490444154816L;
18 | private JProgressBar progressBar;
19 | private int currentProgress;
20 | private Timer timer;
21 |
22 | public SplashScreen(JFrame frame, CustomImage logo) {
23 | JPanel splashFrame = new JPanel();
24 | splashFrame.setBackground(new Color(255, 255, 255));
25 | splashFrame.setBounds(0, -7, 1480, 701);
26 | frame.getContentPane().add(splashFrame);
27 | splashFrame.setVisible(true);
28 | splashFrame.setLayout(null);
29 |
30 | JLabel logoImg = new JLabel(logo.getImage(100, 100));
31 | logoImg.setBounds(690, 259, 100, 100);
32 | splashFrame.add(logoImg);
33 |
34 | progressBar = new JProgressBar();
35 | progressBar.setBounds(690, 400, 100, 100);
36 | progressBar.setMaximum(100);
37 | splashFrame.add(progressBar);
38 |
39 | currentProgress = 0;
40 |
41 | timer = new Timer(3, new ActionListener() {
42 | public void actionPerformed(ActionEvent e) {
43 | currentProgress++;
44 | progressBar.setValue((int) ((currentProgress / (float) progressBar.getMaximum()) * 100));
45 | if (currentProgress == 100) {
46 | timer.stop();
47 | new SignUp(frame, logo);
48 | splashFrame.setVisible(false);
49 | }
50 | }
51 | });
52 | timer.start();
53 |
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/App.java:
--------------------------------------------------------------------------------
1 | import java.awt.EventQueue;
2 | import java.sql.SQLException;
3 |
4 | import javax.swing.JFrame;
5 | import javax.swing.JOptionPane;
6 |
7 | import auth.Auth;
8 | import pages.SplashScreen;
9 | import util.CustomImage;
10 | import util.DataManager;
11 | import util.DataRetriever;
12 | import util.DatabaseManager;
13 |
14 | public class App {
15 |
16 | private JFrame frmHeraldCourseManagement;
17 |
18 | public static void main(String[] args) {
19 | EventQueue.invokeLater(new Runnable() {
20 | public void run() {
21 | try {
22 | App window = new App();
23 | window.frmHeraldCourseManagement.setVisible(true);
24 | } catch (Exception e) {
25 | e.printStackTrace();
26 | }
27 | }
28 | });
29 | }
30 |
31 | public App() {
32 | initialize();
33 | }
34 |
35 | private void initialize() {
36 | frmHeraldCourseManagement = new JFrame();
37 | frmHeraldCourseManagement.setTitle("Herald Course Management System");
38 | frmHeraldCourseManagement.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
39 | frmHeraldCourseManagement.getContentPane().setLayout(null);
40 | frmHeraldCourseManagement.setSize(1480, 720);
41 | frmHeraldCourseManagement.setResizable(false);
42 |
43 | CustomImage logo = new CustomImage("../resources/logo.png");
44 |
45 | new SplashScreen(frmHeraldCourseManagement, logo);
46 |
47 | try {
48 | DatabaseManager db = DatabaseManager.getInstance();
49 | new Auth(db);
50 | new DataRetriever();
51 | new DataManager();
52 |
53 | } catch (SQLException e) {
54 | System.out.println(e.getMessage());
55 | JOptionPane.showMessageDialog(null,
56 | "Can not connect to database!\nPlease make sure mySQL is correctly setup and running!",
57 | "Error 500: Server Communication Failed", JOptionPane.ERROR_MESSAGE);
58 | System.exit(500);
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/models/user/Student.java:
--------------------------------------------------------------------------------
1 | package models.user;
2 |
3 | import models.course.Course;
4 |
5 | public class Student extends SystemUser {
6 | private int id;
7 | private String name;
8 | private String phone;
9 | private String email;
10 | private int level;
11 | private Course enrolledCourse;
12 |
13 | public Student(int id, String name, String phone, String email, int level, Course enrolledCourse) {
14 | super(name, "Student");
15 | this.id = id;
16 | this.name = name;
17 | this.phone = phone;
18 | this.email = email;
19 | this.level = level;
20 | this.enrolledCourse = enrolledCourse;
21 | }
22 |
23 | public Student(int id, String name) {
24 | super(name, "Student");
25 | this.id = id;
26 | this.name = name;
27 | }
28 |
29 | public int getId() {
30 | return id;
31 | }
32 |
33 | public String getName() {
34 | return name;
35 | }
36 |
37 | public String getPhone() {
38 | return phone;
39 | }
40 |
41 | public String getEmail() {
42 | return email;
43 | }
44 |
45 | public int getLevel() {
46 | return level;
47 | }
48 |
49 | public Course getEnrolledCourse() {
50 | return enrolledCourse;
51 | }
52 |
53 | public static Student fromSql(int id, String name, String phone, String email, int level, Course enrolledCourse) {
54 | return new Student(id, name, phone, email, level, enrolledCourse);
55 | }
56 |
57 | public void setId(int id) {
58 | this.id = id;
59 | }
60 |
61 | public void setName(String name) {
62 | this.name = name;
63 | }
64 |
65 | public void setPhone(String phone) {
66 | this.phone = phone;
67 | }
68 |
69 | public void setEmail(String email) {
70 | this.email = email;
71 | }
72 |
73 | public void setLevel(int level) {
74 | this.level = level;
75 | }
76 |
77 | public void setEnrolledCourse(Course enrolledCourse) {
78 | this.enrolledCourse = enrolledCourse;
79 | }
80 |
81 | }
82 |
--------------------------------------------------------------------------------
/src/util/CellRenderer.java:
--------------------------------------------------------------------------------
1 | package util;
2 |
3 | import java.awt.Component;
4 | import java.awt.Font;
5 |
6 | import javax.swing.BoxLayout;
7 | import javax.swing.JLabel;
8 | import javax.swing.JList;
9 | import javax.swing.JPanel;
10 | import javax.swing.ListCellRenderer;
11 | import javax.swing.border.EmptyBorder;
12 |
13 | import models.course.Course;
14 | import models.course.Module;
15 | import models.user.SystemUser;
16 | import models.user.Teacher;
17 |
18 | public class CellRenderer extends JPanel implements ListCellRenderer