diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..8e434f3
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/.project b/.project
new file mode 100644
index 0000000..c8fbecf
--- /dev/null
+++ b/.project
@@ -0,0 +1,17 @@
+
+
+ College Data Management
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..3a21537
--- /dev/null
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/Faculities Profile pic/Akash shah.jpg b/Faculities Profile pic/Akash shah.jpg
new file mode 100644
index 0000000..9b0f3c6
Binary files /dev/null and b/Faculities Profile pic/Akash shah.jpg differ
diff --git a/Faculities Profile pic/Bhavin-Trivedi.png b/Faculities Profile pic/Bhavin-Trivedi.png
new file mode 100644
index 0000000..4185012
Binary files /dev/null and b/Faculities Profile pic/Bhavin-Trivedi.png differ
diff --git a/Faculities Profile pic/Chinkit-Suthar-CE.jpg b/Faculities Profile pic/Chinkit-Suthar-CE.jpg
new file mode 100644
index 0000000..dd00449
Binary files /dev/null and b/Faculities Profile pic/Chinkit-Suthar-CE.jpg differ
diff --git a/Faculities Profile pic/Hemal-Patel-CE.jpg b/Faculities Profile pic/Hemal-Patel-CE.jpg
new file mode 100644
index 0000000..e00b469
Binary files /dev/null and b/Faculities Profile pic/Hemal-Patel-CE.jpg differ
diff --git a/Faculities Profile pic/Jahanvi-Shukla-CE.jpg b/Faculities Profile pic/Jahanvi-Shukla-CE.jpg
new file mode 100644
index 0000000..fa9161b
Binary files /dev/null and b/Faculities Profile pic/Jahanvi-Shukla-CE.jpg differ
diff --git a/Faculities Profile pic/Jaymin-Dave-IT.jpg b/Faculities Profile pic/Jaymin-Dave-IT.jpg
new file mode 100644
index 0000000..07c5293
Binary files /dev/null and b/Faculities Profile pic/Jaymin-Dave-IT.jpg differ
diff --git a/Faculities Profile pic/Mitesh Patel.jpg b/Faculities Profile pic/Mitesh Patel.jpg
new file mode 100644
index 0000000..0e21aa3
Binary files /dev/null and b/Faculities Profile pic/Mitesh Patel.jpg differ
diff --git a/Faculities Profile pic/Mohmmed Vyada.jpg b/Faculities Profile pic/Mohmmed Vyada.jpg
new file mode 100644
index 0000000..4812a6b
Binary files /dev/null and b/Faculities Profile pic/Mohmmed Vyada.jpg differ
diff --git a/Faculities Profile pic/Niti-Shah-CE.jpg b/Faculities Profile pic/Niti-Shah-CE.jpg
new file mode 100644
index 0000000..f5b8b15
Binary files /dev/null and b/Faculities Profile pic/Niti-Shah-CE.jpg differ
diff --git a/Faculities Profile pic/Ravi Shukla.jpg b/Faculities Profile pic/Ravi Shukla.jpg
new file mode 100644
index 0000000..3547a72
Binary files /dev/null and b/Faculities Profile pic/Ravi Shukla.jpg differ
diff --git a/Faculities Profile pic/Rikin Thakkar.jpg b/Faculities Profile pic/Rikin Thakkar.jpg
new file mode 100644
index 0000000..1b2aeba
Binary files /dev/null and b/Faculities Profile pic/Rikin Thakkar.jpg differ
diff --git a/Faculities Profile pic/Shivang-Prajapati.png b/Faculities Profile pic/Shivang-Prajapati.png
new file mode 100644
index 0000000..5843b94
Binary files /dev/null and b/Faculities Profile pic/Shivang-Prajapati.png differ
diff --git a/Faculities Profile pic/Sunny-Rupabhindra.png b/Faculities Profile pic/Sunny-Rupabhindra.png
new file mode 100644
index 0000000..4d3cac7
Binary files /dev/null and b/Faculities Profile pic/Sunny-Rupabhindra.png differ
diff --git a/Faculities Profile pic/Trupesh Patel.jpg b/Faculities Profile pic/Trupesh Patel.jpg
new file mode 100644
index 0000000..d5eb3ba
Binary files /dev/null and b/Faculities Profile pic/Trupesh Patel.jpg differ
diff --git a/Faculities Profile pic/Vimal Nayak.jpg b/Faculities Profile pic/Vimal Nayak.jpg
new file mode 100644
index 0000000..8a0fa50
Binary files /dev/null and b/Faculities Profile pic/Vimal Nayak.jpg differ
diff --git a/Faculities Profile pic/kunj Patel.jpg b/Faculities Profile pic/kunj Patel.jpg
new file mode 100644
index 0000000..0451a31
Binary files /dev/null and b/Faculities Profile pic/kunj Patel.jpg differ
diff --git a/Faculities Profile pic/satvik-sir1.jpg b/Faculities Profile pic/satvik-sir1.jpg
new file mode 100644
index 0000000..9c0279b
Binary files /dev/null and b/Faculities Profile pic/satvik-sir1.jpg differ
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..67e412a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,92 @@
+# College Management System In Java
+
+## Hi there !
+
+Here I have designed and developed College management system. The Technology I have used is Java Swing, and database i have used is MySql.
+This design is purely coded myself no copied content.
+
+Thanks !
+
+## Features
+
+ * Common Features
+ * Cources Management
+ * Subjects Management
+ * Students Management
+ * Faculties Management
+ * Students Attandance Management
+ * Student Marks Management
+ * Advance Features 🔥
+ * Rollnumber Generator
+ * Chatting
+ * Message delivered
+ * Unseen messages
+ * Notification
+ * Group chatting
+ * Photo view of Students and Faculties
+ * Student or Faculty login history
+ * Download Marksheet
+ * Notification
+ * Declare result
+
+
+## Installation
+
+* Import this project in your IDE
+* Create new Database and set name as 'Collegedata' after that import 'Collegedata.sql' file (Attached with this folder) in this database.
+
+## Database Connection
+
+* I have used following 👇 data for database connection
+ * url="jdbc:mysql://localhost:3306/Collegedata";
+ * user name="root";
+ * password="";
+
+* If you want to change this data then open ".\src\Collegeapplication\common\DataBaseConnection.java"
+
+
+## How to Run
+
+* Start Database Server
+* Start Chat Server
+* Open "src/Collegeapplication/login/LoginPageFrame.java" Run this file
+* Admin userid : admin
+* Admin password : admin
+* Faculty userid : Faculty id
+* Student Userid : cource-sem-rollnumber (IT-1-1001)
+
+## Youtube Demo
+
+[
](https://youtu.be/0Fik73ZznG0)
+
+## Screenshots
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## About
+
+My name is [Ajaysinh Rathod](https://github.com/Ajaysinh1290). I'm studying Information Technology (2nd Year) in SOCET(Ahmedabad). Contact me for any improvement in this project.
+
+
+
+Email : ajaysinhrathod1290@gmail.com
+
+# Social Media Accounts
+[](https://www.instagram.com/ll_ajayrathod_ll/)
+[](https://www.facebook.com/ajaysinh.rathod.7927)
+[](https://www.youtube.com/channel/UCbhGYVadJsZtJzHYMWLNRRQ)
+[](https://twitter.com/Ajaysin34751867)
+
diff --git a/Students Profile pic/Abhi Gaundani.jpeg b/Students Profile pic/Abhi Gaundani.jpeg
new file mode 100644
index 0000000..8c5824e
Binary files /dev/null and b/Students Profile pic/Abhi Gaundani.jpeg differ
diff --git a/Students Profile pic/Ajay Parmar.png b/Students Profile pic/Ajay Parmar.png
new file mode 100644
index 0000000..3fa8a82
Binary files /dev/null and b/Students Profile pic/Ajay Parmar.png differ
diff --git a/Students Profile pic/Ajaysinh Rathod.jpeg b/Students Profile pic/Ajaysinh Rathod.jpeg
new file mode 100644
index 0000000..d844f21
Binary files /dev/null and b/Students Profile pic/Ajaysinh Rathod.jpeg differ
diff --git a/Students Profile pic/AnishBhesaniya.png b/Students Profile pic/AnishBhesaniya.png
new file mode 100644
index 0000000..589d8f5
Binary files /dev/null and b/Students Profile pic/AnishBhesaniya.png differ
diff --git a/Students Profile pic/Bhautik Bhanderi.jpeg b/Students Profile pic/Bhautik Bhanderi.jpeg
new file mode 100644
index 0000000..c770d46
Binary files /dev/null and b/Students Profile pic/Bhautik Bhanderi.jpeg differ
diff --git a/Students Profile pic/Darshan Asalaliya.jpeg b/Students Profile pic/Darshan Asalaliya.jpeg
new file mode 100644
index 0000000..b020d0a
Binary files /dev/null and b/Students Profile pic/Darshan Asalaliya.jpeg differ
diff --git a/Students Profile pic/Darshil Patel.png b/Students Profile pic/Darshil Patel.png
new file mode 100644
index 0000000..2f46b45
Binary files /dev/null and b/Students Profile pic/Darshil Patel.png differ
diff --git a/Students Profile pic/Harsh Jarsaniya.png b/Students Profile pic/Harsh Jarsaniya.png
new file mode 100644
index 0000000..d904564
Binary files /dev/null and b/Students Profile pic/Harsh Jarsaniya.png differ
diff --git a/Students Profile pic/Madhuram Savaliya.png b/Students Profile pic/Madhuram Savaliya.png
new file mode 100644
index 0000000..01360a1
Binary files /dev/null and b/Students Profile pic/Madhuram Savaliya.png differ
diff --git a/Students Profile pic/Milan Bavishi.png b/Students Profile pic/Milan Bavishi.png
new file mode 100644
index 0000000..d22d8df
Binary files /dev/null and b/Students Profile pic/Milan Bavishi.png differ
diff --git a/Students Profile pic/Sahil Patel.png b/Students Profile pic/Sahil Patel.png
new file mode 100644
index 0000000..47e578a
Binary files /dev/null and b/Students Profile pic/Sahil Patel.png differ
diff --git a/Students Profile pic/Utsav Patel.jpeg b/Students Profile pic/Utsav Patel.jpeg
new file mode 100644
index 0000000..020d411
Binary files /dev/null and b/Students Profile pic/Utsav Patel.jpeg differ
diff --git a/Students Profile pic/Vadansinh Rathod.jpeg b/Students Profile pic/Vadansinh Rathod.jpeg
new file mode 100644
index 0000000..882b9b6
Binary files /dev/null and b/Students Profile pic/Vadansinh Rathod.jpeg differ
diff --git a/Students Profile pic/Yash Patel.png b/Students Profile pic/Yash Patel.png
new file mode 100644
index 0000000..9f13f04
Binary files /dev/null and b/Students Profile pic/Yash Patel.png differ
diff --git a/Students Profile pic/Yash Prajapati.jpeg b/Students Profile pic/Yash Prajapati.jpeg
new file mode 100644
index 0000000..3349eec
Binary files /dev/null and b/Students Profile pic/Yash Prajapati.jpeg differ
diff --git a/assets/Admin.png b/assets/Admin.png
new file mode 100644
index 0000000..7e59d15
Binary files /dev/null and b/assets/Admin.png differ
diff --git a/assets/Assign Subjectac.png b/assets/Assign Subjectac.png
new file mode 100644
index 0000000..49ca1c4
Binary files /dev/null and b/assets/Assign Subjectac.png differ
diff --git a/assets/Assign Subjectdac.png b/assets/Assign Subjectdac.png
new file mode 100644
index 0000000..ee66d82
Binary files /dev/null and b/assets/Assign Subjectdac.png differ
diff --git a/assets/Attandance Reportac.png b/assets/Attandance Reportac.png
new file mode 100644
index 0000000..227253a
Binary files /dev/null and b/assets/Attandance Reportac.png differ
diff --git a/assets/Attandance Reportdac.png b/assets/Attandance Reportdac.png
new file mode 100644
index 0000000..dbb6ddd
Binary files /dev/null and b/assets/Attandance Reportdac.png differ
diff --git a/assets/Chatac.png b/assets/Chatac.png
new file mode 100644
index 0000000..b63c699
Binary files /dev/null and b/assets/Chatac.png differ
diff --git a/assets/Chatdac.png b/assets/Chatdac.png
new file mode 100644
index 0000000..b1c02cd
Binary files /dev/null and b/assets/Chatdac.png differ
diff --git a/assets/Contact Usac.png b/assets/Contact Usac.png
new file mode 100644
index 0000000..ca69171
Binary files /dev/null and b/assets/Contact Usac.png differ
diff --git a/assets/Contact Usdac.png b/assets/Contact Usdac.png
new file mode 100644
index 0000000..d11b1b9
Binary files /dev/null and b/assets/Contact Usdac.png differ
diff --git a/assets/Contact-Usac.png b/assets/Contact-Usac.png
new file mode 100644
index 0000000..99aa4e8
Binary files /dev/null and b/assets/Contact-Usac.png differ
diff --git a/assets/Contact-Usdac.png b/assets/Contact-Usdac.png
new file mode 100644
index 0000000..383af60
Binary files /dev/null and b/assets/Contact-Usdac.png differ
diff --git a/assets/Courcesac.png b/assets/Courcesac.png
new file mode 100644
index 0000000..9f9fce4
Binary files /dev/null and b/assets/Courcesac.png differ
diff --git a/assets/Courcesdac.png b/assets/Courcesdac.png
new file mode 100644
index 0000000..24671c5
Binary files /dev/null and b/assets/Courcesdac.png differ
diff --git a/assets/Enter Marksac.png b/assets/Enter Marksac.png
new file mode 100644
index 0000000..59d4fa7
Binary files /dev/null and b/assets/Enter Marksac.png differ
diff --git a/assets/Enter Marksdac.png b/assets/Enter Marksdac.png
new file mode 100644
index 0000000..f5bf118
Binary files /dev/null and b/assets/Enter Marksdac.png differ
diff --git a/assets/Exitac.png b/assets/Exitac.png
new file mode 100644
index 0000000..8c44558
Binary files /dev/null and b/assets/Exitac.png differ
diff --git a/assets/Exitdac.png b/assets/Exitdac.png
new file mode 100644
index 0000000..53257f6
Binary files /dev/null and b/assets/Exitdac.png differ
diff --git a/assets/Faculitiesac.png b/assets/Faculitiesac.png
new file mode 100644
index 0000000..654dee9
Binary files /dev/null and b/assets/Faculitiesac.png differ
diff --git a/assets/Faculitiesdac.png b/assets/Faculitiesdac.png
new file mode 100644
index 0000000..ade6b02
Binary files /dev/null and b/assets/Faculitiesdac.png differ
diff --git a/assets/Homeac.png b/assets/Homeac.png
new file mode 100644
index 0000000..d74a545
Binary files /dev/null and b/assets/Homeac.png differ
diff --git a/assets/Homedac.png b/assets/Homedac.png
new file mode 100644
index 0000000..6f256a0
Binary files /dev/null and b/assets/Homedac.png differ
diff --git a/assets/Logoutac.png b/assets/Logoutac.png
new file mode 100644
index 0000000..d3d27f6
Binary files /dev/null and b/assets/Logoutac.png differ
diff --git a/assets/Logoutdac.png b/assets/Logoutdac.png
new file mode 100644
index 0000000..2331911
Binary files /dev/null and b/assets/Logoutdac.png differ
diff --git a/assets/Mark Attandanceac.png b/assets/Mark Attandanceac.png
new file mode 100644
index 0000000..956762e
Binary files /dev/null and b/assets/Mark Attandanceac.png differ
diff --git a/assets/Mark Attandancedac.png b/assets/Mark Attandancedac.png
new file mode 100644
index 0000000..113eb6b
Binary files /dev/null and b/assets/Mark Attandancedac.png differ
diff --git a/assets/Marksheet Reportac.png b/assets/Marksheet Reportac.png
new file mode 100644
index 0000000..6992531
Binary files /dev/null and b/assets/Marksheet Reportac.png differ
diff --git a/assets/Marksheet Reportdac.png b/assets/Marksheet Reportdac.png
new file mode 100644
index 0000000..d62acf4
Binary files /dev/null and b/assets/Marksheet Reportdac.png differ
diff --git a/assets/Notificationac.png b/assets/Notificationac.png
new file mode 100644
index 0000000..785df05
Binary files /dev/null and b/assets/Notificationac.png differ
diff --git a/assets/Notificationdac.png b/assets/Notificationdac.png
new file mode 100644
index 0000000..6a98793
Binary files /dev/null and b/assets/Notificationdac.png differ
diff --git a/assets/Profileac.png b/assets/Profileac.png
new file mode 100644
index 0000000..59da6bd
Binary files /dev/null and b/assets/Profileac.png differ
diff --git a/assets/Profiledac.png b/assets/Profiledac.png
new file mode 100644
index 0000000..aefcc52
Binary files /dev/null and b/assets/Profiledac.png differ
diff --git a/assets/Searchac.png b/assets/Searchac.png
new file mode 100644
index 0000000..3b5820d
Binary files /dev/null and b/assets/Searchac.png differ
diff --git a/assets/Searchdac.png b/assets/Searchdac.png
new file mode 100644
index 0000000..be133d0
Binary files /dev/null and b/assets/Searchdac.png differ
diff --git a/assets/Studentsac.png b/assets/Studentsac.png
new file mode 100644
index 0000000..7a9f7e0
Binary files /dev/null and b/assets/Studentsac.png differ
diff --git a/assets/Studentsdac.png b/assets/Studentsdac.png
new file mode 100644
index 0000000..dedd66c
Binary files /dev/null and b/assets/Studentsdac.png differ
diff --git a/assets/Subjectsac.png b/assets/Subjectsac.png
new file mode 100644
index 0000000..983efe4
Binary files /dev/null and b/assets/Subjectsac.png differ
diff --git a/assets/Subjectsdac.png b/assets/Subjectsdac.png
new file mode 100644
index 0000000..bade079
Binary files /dev/null and b/assets/Subjectsdac.png differ
diff --git a/assets/Usersac.png b/assets/Usersac.png
new file mode 100644
index 0000000..885ba76
Binary files /dev/null and b/assets/Usersac.png differ
diff --git a/assets/Usersdac.png b/assets/Usersdac.png
new file mode 100644
index 0000000..d2fbb36
Binary files /dev/null and b/assets/Usersdac.png differ
diff --git a/assets/adminlogin.png b/assets/adminlogin.png
new file mode 100644
index 0000000..3592c95
Binary files /dev/null and b/assets/adminlogin.png differ
diff --git a/assets/adminprofile.png b/assets/adminprofile.png
new file mode 100644
index 0000000..cac4a5b
Binary files /dev/null and b/assets/adminprofile.png differ
diff --git a/assets/arcodding.png b/assets/arcodding.png
new file mode 100644
index 0000000..9461f6b
Binary files /dev/null and b/assets/arcodding.png differ
diff --git a/assets/assignsubject.png b/assets/assignsubject.png
new file mode 100644
index 0000000..147e8e4
Binary files /dev/null and b/assets/assignsubject.png differ
diff --git a/assets/attandance.png b/assets/attandance.png
new file mode 100644
index 0000000..5d675eb
Binary files /dev/null and b/assets/attandance.png differ
diff --git a/assets/attandancereport.png b/assets/attandancereport.png
new file mode 100644
index 0000000..766f728
Binary files /dev/null and b/assets/attandancereport.png differ
diff --git a/assets/back.png b/assets/back.png
new file mode 100644
index 0000000..7f20539
Binary files /dev/null and b/assets/back.png differ
diff --git a/assets/backgroundimage1.jpg b/assets/backgroundimage1.jpg
new file mode 100644
index 0000000..4e9477e
Binary files /dev/null and b/assets/backgroundimage1.jpg differ
diff --git a/assets/backgroundimage2.jpg b/assets/backgroundimage2.jpg
new file mode 100644
index 0000000..fece99f
Binary files /dev/null and b/assets/backgroundimage2.jpg differ
diff --git a/assets/backgroundimage3.jpg b/assets/backgroundimage3.jpg
new file mode 100644
index 0000000..921e7df
Binary files /dev/null and b/assets/backgroundimage3.jpg differ
diff --git a/assets/backgroundimage4.jpg b/assets/backgroundimage4.jpg
new file mode 100644
index 0000000..0140605
Binary files /dev/null and b/assets/backgroundimage4.jpg differ
diff --git a/assets/backgroundimage5.jpg b/assets/backgroundimage5.jpg
new file mode 100644
index 0000000..58b8e22
Binary files /dev/null and b/assets/backgroundimage5.jpg differ
diff --git a/assets/book.png b/assets/book.png
new file mode 100644
index 0000000..3167db6
Binary files /dev/null and b/assets/book.png differ
diff --git a/assets/callinfo.png b/assets/callinfo.png
new file mode 100644
index 0000000..114c9fb
Binary files /dev/null and b/assets/callinfo.png differ
diff --git a/assets/chatbg.jpg b/assets/chatbg.jpg
new file mode 100644
index 0000000..8ca9d4c
Binary files /dev/null and b/assets/chatbg.jpg differ
diff --git a/assets/cources.png b/assets/cources.png
new file mode 100644
index 0000000..996437f
Binary files /dev/null and b/assets/cources.png differ
diff --git a/assets/courceshomepage.png b/assets/courceshomepage.png
new file mode 100644
index 0000000..affdd64
Binary files /dev/null and b/assets/courceshomepage.png differ
diff --git a/assets/dobinfo.png b/assets/dobinfo.png
new file mode 100644
index 0000000..a6cecc6
Binary files /dev/null and b/assets/dobinfo.png differ
diff --git a/assets/doubletick.png b/assets/doubletick.png
new file mode 100644
index 0000000..72ba137
Binary files /dev/null and b/assets/doubletick.png differ
diff --git a/assets/doubletickblue.png b/assets/doubletickblue.png
new file mode 100644
index 0000000..00f58d8
Binary files /dev/null and b/assets/doubletickblue.png differ
diff --git a/assets/doubletickgreen.png b/assets/doubletickgreen.png
new file mode 100644
index 0000000..427fe85
Binary files /dev/null and b/assets/doubletickgreen.png differ
diff --git a/assets/doubletickorange.png b/assets/doubletickorange.png
new file mode 100644
index 0000000..ec78c1c
Binary files /dev/null and b/assets/doubletickorange.png differ
diff --git a/assets/doubletickyellow.png b/assets/doubletickyellow.png
new file mode 100644
index 0000000..b4c555b
Binary files /dev/null and b/assets/doubletickyellow.png differ
diff --git a/assets/downarrow1.png b/assets/downarrow1.png
new file mode 100644
index 0000000..f50f10a
Binary files /dev/null and b/assets/downarrow1.png differ
diff --git a/assets/downloadbutton.png b/assets/downloadbutton.png
new file mode 100644
index 0000000..598f67d
Binary files /dev/null and b/assets/downloadbutton.png differ
diff --git a/assets/downloadedbutton.png b/assets/downloadedbutton.png
new file mode 100644
index 0000000..f364dbe
Binary files /dev/null and b/assets/downloadedbutton.png differ
diff --git a/assets/email.png b/assets/email.png
new file mode 100644
index 0000000..3edd6ea
Binary files /dev/null and b/assets/email.png differ
diff --git a/assets/emailinfo.png b/assets/emailinfo.png
new file mode 100644
index 0000000..7dbacd2
Binary files /dev/null and b/assets/emailinfo.png differ
diff --git a/assets/exit.png b/assets/exit.png
new file mode 100644
index 0000000..324d79d
Binary files /dev/null and b/assets/exit.png differ
diff --git a/assets/faculities.png b/assets/faculities.png
new file mode 100644
index 0000000..6f97980
Binary files /dev/null and b/assets/faculities.png differ
diff --git a/assets/facultyhomepage.png b/assets/facultyhomepage.png
new file mode 100644
index 0000000..37a8581
Binary files /dev/null and b/assets/facultyhomepage.png differ
diff --git a/assets/facultylogin.png b/assets/facultylogin.png
new file mode 100644
index 0000000..c7907a3
Binary files /dev/null and b/assets/facultylogin.png differ
diff --git a/assets/graducationcap.png b/assets/graducationcap.png
new file mode 100644
index 0000000..1d775ac
Binary files /dev/null and b/assets/graducationcap.png differ
diff --git a/assets/historybutton.png b/assets/historybutton.png
new file mode 100644
index 0000000..2b8eeac
Binary files /dev/null and b/assets/historybutton.png differ
diff --git a/assets/home.png b/assets/home.png
new file mode 100644
index 0000000..99a6de4
Binary files /dev/null and b/assets/home.png differ
diff --git a/assets/jpgbutton.png b/assets/jpgbutton.png
new file mode 100644
index 0000000..7c09b64
Binary files /dev/null and b/assets/jpgbutton.png differ
diff --git a/assets/lecturerhomepage.png b/assets/lecturerhomepage.png
new file mode 100644
index 0000000..908d582
Binary files /dev/null and b/assets/lecturerhomepage.png differ
diff --git a/assets/locationinfo.png b/assets/locationinfo.png
new file mode 100644
index 0000000..32c5fc7
Binary files /dev/null and b/assets/locationinfo.png differ
diff --git a/assets/logout.png b/assets/logout.png
new file mode 100644
index 0000000..2a4e598
Binary files /dev/null and b/assets/logout.png differ
diff --git a/assets/mailinfo.png b/assets/mailinfo.png
new file mode 100644
index 0000000..e6486d2
Binary files /dev/null and b/assets/mailinfo.png differ
diff --git a/assets/marks.png b/assets/marks.png
new file mode 100644
index 0000000..a6de6cb
Binary files /dev/null and b/assets/marks.png differ
diff --git a/assets/messagecount.png b/assets/messagecount.png
new file mode 100644
index 0000000..1716b92
Binary files /dev/null and b/assets/messagecount.png differ
diff --git a/assets/notfound.png b/assets/notfound.png
new file mode 100644
index 0000000..d616fd4
Binary files /dev/null and b/assets/notfound.png differ
diff --git a/assets/notfound2.png b/assets/notfound2.png
new file mode 100644
index 0000000..d0f055e
Binary files /dev/null and b/assets/notfound2.png differ
diff --git a/assets/notification.png b/assets/notification.png
new file mode 100644
index 0000000..1f204c9
Binary files /dev/null and b/assets/notification.png differ
diff --git a/assets/notificationhomepage.png b/assets/notificationhomepage.png
new file mode 100644
index 0000000..b0ab11e
Binary files /dev/null and b/assets/notificationhomepage.png differ
diff --git a/assets/onlinestatus.png b/assets/onlinestatus.png
new file mode 100644
index 0000000..8d4aad2
Binary files /dev/null and b/assets/onlinestatus.png differ
diff --git a/assets/onlinestatusbig.png b/assets/onlinestatusbig.png
new file mode 100644
index 0000000..cf0173f
Binary files /dev/null and b/assets/onlinestatusbig.png differ
diff --git a/assets/password.png b/assets/password.png
new file mode 100644
index 0000000..e50b18b
Binary files /dev/null and b/assets/password.png differ
diff --git a/assets/password1.png b/assets/password1.png
new file mode 100644
index 0000000..742d3a9
Binary files /dev/null and b/assets/password1.png differ
diff --git a/assets/pdfbutton.png b/assets/pdfbutton.png
new file mode 100644
index 0000000..1d10472
Binary files /dev/null and b/assets/pdfbutton.png differ
diff --git a/assets/pngbutton.png b/assets/pngbutton.png
new file mode 100644
index 0000000..4858057
Binary files /dev/null and b/assets/pngbutton.png differ
diff --git a/assets/printbutton.png b/assets/printbutton.png
new file mode 100644
index 0000000..b72778a
Binary files /dev/null and b/assets/printbutton.png differ
diff --git a/assets/profilepic.png b/assets/profilepic.png
new file mode 100644
index 0000000..5ff53bd
Binary files /dev/null and b/assets/profilepic.png differ
diff --git a/assets/profilepicicon.jpg b/assets/profilepicicon.jpg
new file mode 100644
index 0000000..07b46d4
Binary files /dev/null and b/assets/profilepicicon.jpg differ
diff --git a/assets/profilepicicon.png b/assets/profilepicicon.png
new file mode 100644
index 0000000..e9781c1
Binary files /dev/null and b/assets/profilepicicon.png differ
diff --git a/assets/search.png b/assets/search.png
new file mode 100644
index 0000000..c7d99be
Binary files /dev/null and b/assets/search.png differ
diff --git a/assets/searchuser.png b/assets/searchuser.png
new file mode 100644
index 0000000..b64c5e9
Binary files /dev/null and b/assets/searchuser.png differ
diff --git a/assets/selectchaticon.png b/assets/selectchaticon.png
new file mode 100644
index 0000000..35c36d1
Binary files /dev/null and b/assets/selectchaticon.png differ
diff --git a/assets/selectedcheckbox.png b/assets/selectedcheckbox.png
new file mode 100644
index 0000000..77f135e
Binary files /dev/null and b/assets/selectedcheckbox.png differ
diff --git a/assets/selectedcheckboxforheader.png b/assets/selectedcheckboxforheader.png
new file mode 100644
index 0000000..be276c4
Binary files /dev/null and b/assets/selectedcheckboxforheader.png differ
diff --git a/assets/selectedcheckboxicon.png b/assets/selectedcheckboxicon.png
new file mode 100644
index 0000000..db5ede0
Binary files /dev/null and b/assets/selectedcheckboxicon.png differ
diff --git a/assets/sendmessage.png b/assets/sendmessage.png
new file mode 100644
index 0000000..0fbefdc
Binary files /dev/null and b/assets/sendmessage.png differ
diff --git a/assets/singletick.png b/assets/singletick.png
new file mode 100644
index 0000000..38f88d4
Binary files /dev/null and b/assets/singletick.png differ
diff --git a/assets/student.png b/assets/student.png
new file mode 100644
index 0000000..c820a09
Binary files /dev/null and b/assets/student.png differ
diff --git a/assets/studenthomepage.png b/assets/studenthomepage.png
new file mode 100644
index 0000000..bff1fb7
Binary files /dev/null and b/assets/studenthomepage.png differ
diff --git a/assets/studentlogin.png b/assets/studentlogin.png
new file mode 100644
index 0000000..078b76a
Binary files /dev/null and b/assets/studentlogin.png differ
diff --git a/assets/subject.png b/assets/subject.png
new file mode 100644
index 0000000..7aadb85
Binary files /dev/null and b/assets/subject.png differ
diff --git a/assets/subjects.png b/assets/subjects.png
new file mode 100644
index 0000000..ee6b3be
Binary files /dev/null and b/assets/subjects.png differ
diff --git a/assets/subjects2.png b/assets/subjects2.png
new file mode 100644
index 0000000..1985c49
Binary files /dev/null and b/assets/subjects2.png differ
diff --git a/assets/submitted.png b/assets/submitted.png
new file mode 100644
index 0000000..12b6dc6
Binary files /dev/null and b/assets/submitted.png differ
diff --git a/assets/teacher.png b/assets/teacher.png
new file mode 100644
index 0000000..2de1ce4
Binary files /dev/null and b/assets/teacher.png differ
diff --git a/assets/undo.png b/assets/undo.png
new file mode 100644
index 0000000..3b457fd
Binary files /dev/null and b/assets/undo.png differ
diff --git a/assets/unselectedcheckbox.png b/assets/unselectedcheckbox.png
new file mode 100644
index 0000000..0633743
Binary files /dev/null and b/assets/unselectedcheckbox.png differ
diff --git a/assets/unselectedcheckboxforheader.png b/assets/unselectedcheckboxforheader.png
new file mode 100644
index 0000000..82b2a0f
Binary files /dev/null and b/assets/unselectedcheckboxforheader.png differ
diff --git a/assets/unselectedcheckboxicon.png b/assets/unselectedcheckboxicon.png
new file mode 100644
index 0000000..f1e49e9
Binary files /dev/null and b/assets/unselectedcheckboxicon.png differ
diff --git a/assets/user.png b/assets/user.png
new file mode 100644
index 0000000..efb80e0
Binary files /dev/null and b/assets/user.png differ
diff --git a/assets/userid.png b/assets/userid.png
new file mode 100644
index 0000000..bdece34
Binary files /dev/null and b/assets/userid.png differ
diff --git a/bin/collegeapplication/admin/Admin.class b/bin/collegeapplication/admin/Admin.class
new file mode 100644
index 0000000..619d58e
Binary files /dev/null and b/bin/collegeapplication/admin/Admin.class differ
diff --git a/bin/collegeapplication/admin/AdminData.class b/bin/collegeapplication/admin/AdminData.class
new file mode 100644
index 0000000..8499bd9
Binary files /dev/null and b/bin/collegeapplication/admin/AdminData.class differ
diff --git a/bin/collegeapplication/admin/AdminMain$1.class b/bin/collegeapplication/admin/AdminMain$1.class
new file mode 100644
index 0000000..3a83011
Binary files /dev/null and b/bin/collegeapplication/admin/AdminMain$1.class differ
diff --git a/bin/collegeapplication/admin/AdminMain$2.class b/bin/collegeapplication/admin/AdminMain$2.class
new file mode 100644
index 0000000..807b3f1
Binary files /dev/null and b/bin/collegeapplication/admin/AdminMain$2.class differ
diff --git a/bin/collegeapplication/admin/AdminMain$3.class b/bin/collegeapplication/admin/AdminMain$3.class
new file mode 100644
index 0000000..35d1d13
Binary files /dev/null and b/bin/collegeapplication/admin/AdminMain$3.class differ
diff --git a/bin/collegeapplication/admin/AdminMain.class b/bin/collegeapplication/admin/AdminMain.class
new file mode 100644
index 0000000..c2e6490
Binary files /dev/null and b/bin/collegeapplication/admin/AdminMain.class differ
diff --git a/bin/collegeapplication/admin/AdminProfilePanel$1.class b/bin/collegeapplication/admin/AdminProfilePanel$1.class
new file mode 100644
index 0000000..0895bac
Binary files /dev/null and b/bin/collegeapplication/admin/AdminProfilePanel$1.class differ
diff --git a/bin/collegeapplication/admin/AdminProfilePanel$2.class b/bin/collegeapplication/admin/AdminProfilePanel$2.class
new file mode 100644
index 0000000..6fc0e8c
Binary files /dev/null and b/bin/collegeapplication/admin/AdminProfilePanel$2.class differ
diff --git a/bin/collegeapplication/admin/AdminProfilePanel$3.class b/bin/collegeapplication/admin/AdminProfilePanel$3.class
new file mode 100644
index 0000000..30a58fe
Binary files /dev/null and b/bin/collegeapplication/admin/AdminProfilePanel$3.class differ
diff --git a/bin/collegeapplication/admin/AdminProfilePanel$4.class b/bin/collegeapplication/admin/AdminProfilePanel$4.class
new file mode 100644
index 0000000..bb414b6
Binary files /dev/null and b/bin/collegeapplication/admin/AdminProfilePanel$4.class differ
diff --git a/bin/collegeapplication/admin/AdminProfilePanel$5.class b/bin/collegeapplication/admin/AdminProfilePanel$5.class
new file mode 100644
index 0000000..26b9014
Binary files /dev/null and b/bin/collegeapplication/admin/AdminProfilePanel$5.class differ
diff --git a/bin/collegeapplication/admin/AdminProfilePanel$6.class b/bin/collegeapplication/admin/AdminProfilePanel$6.class
new file mode 100644
index 0000000..443051c
Binary files /dev/null and b/bin/collegeapplication/admin/AdminProfilePanel$6.class differ
diff --git a/bin/collegeapplication/admin/AdminProfilePanel.class b/bin/collegeapplication/admin/AdminProfilePanel.class
new file mode 100644
index 0000000..1fff39c
Binary files /dev/null and b/bin/collegeapplication/admin/AdminProfilePanel.class differ
diff --git a/bin/collegeapplication/admin/EditAdminDetailsDialog.class b/bin/collegeapplication/admin/EditAdminDetailsDialog.class
new file mode 100644
index 0000000..1781e01
Binary files /dev/null and b/bin/collegeapplication/admin/EditAdminDetailsDialog.class differ
diff --git a/bin/collegeapplication/admin/EditAdminLinksDialog.class b/bin/collegeapplication/admin/EditAdminLinksDialog.class
new file mode 100644
index 0000000..9cdedb6
Binary files /dev/null and b/bin/collegeapplication/admin/EditAdminLinksDialog.class differ
diff --git a/bin/collegeapplication/chat/ChatData.class b/bin/collegeapplication/chat/ChatData.class
new file mode 100644
index 0000000..c3fa009
Binary files /dev/null and b/bin/collegeapplication/chat/ChatData.class differ
diff --git a/bin/collegeapplication/chat/ChatInfoPanel$1.class b/bin/collegeapplication/chat/ChatInfoPanel$1.class
new file mode 100644
index 0000000..bbbd770
Binary files /dev/null and b/bin/collegeapplication/chat/ChatInfoPanel$1.class differ
diff --git a/bin/collegeapplication/chat/ChatInfoPanel.class b/bin/collegeapplication/chat/ChatInfoPanel.class
new file mode 100644
index 0000000..56ab46a
Binary files /dev/null and b/bin/collegeapplication/chat/ChatInfoPanel.class differ
diff --git a/bin/collegeapplication/chat/ChatMainPanel$1.class b/bin/collegeapplication/chat/ChatMainPanel$1.class
new file mode 100644
index 0000000..a21fe9b
Binary files /dev/null and b/bin/collegeapplication/chat/ChatMainPanel$1.class differ
diff --git a/bin/collegeapplication/chat/ChatMainPanel$2.class b/bin/collegeapplication/chat/ChatMainPanel$2.class
new file mode 100644
index 0000000..3c541ca
Binary files /dev/null and b/bin/collegeapplication/chat/ChatMainPanel$2.class differ
diff --git a/bin/collegeapplication/chat/ChatMainPanel$3.class b/bin/collegeapplication/chat/ChatMainPanel$3.class
new file mode 100644
index 0000000..a4052d3
Binary files /dev/null and b/bin/collegeapplication/chat/ChatMainPanel$3.class differ
diff --git a/bin/collegeapplication/chat/ChatMainPanel$4.class b/bin/collegeapplication/chat/ChatMainPanel$4.class
new file mode 100644
index 0000000..ed14dd8
Binary files /dev/null and b/bin/collegeapplication/chat/ChatMainPanel$4.class differ
diff --git a/bin/collegeapplication/chat/ChatMainPanel$MyDocumentListener.class b/bin/collegeapplication/chat/ChatMainPanel$MyDocumentListener.class
new file mode 100644
index 0000000..c24cab5
Binary files /dev/null and b/bin/collegeapplication/chat/ChatMainPanel$MyDocumentListener.class differ
diff --git a/bin/collegeapplication/chat/ChatMainPanel.class b/bin/collegeapplication/chat/ChatMainPanel.class
new file mode 100644
index 0000000..83f5c38
Binary files /dev/null and b/bin/collegeapplication/chat/ChatMainPanel.class differ
diff --git a/bin/collegeapplication/chat/ChatPanel.class b/bin/collegeapplication/chat/ChatPanel.class
new file mode 100644
index 0000000..54b4154
Binary files /dev/null and b/bin/collegeapplication/chat/ChatPanel.class differ
diff --git a/bin/collegeapplication/chat/ChatUser.class b/bin/collegeapplication/chat/ChatUser.class
new file mode 100644
index 0000000..4df94b0
Binary files /dev/null and b/bin/collegeapplication/chat/ChatUser.class differ
diff --git a/bin/collegeapplication/chat/ClientHandler.class b/bin/collegeapplication/chat/ClientHandler.class
new file mode 100644
index 0000000..d467aac
Binary files /dev/null and b/bin/collegeapplication/chat/ClientHandler.class differ
diff --git a/bin/collegeapplication/chat/ContactInfo.class b/bin/collegeapplication/chat/ContactInfo.class
new file mode 100644
index 0000000..36862f1
Binary files /dev/null and b/bin/collegeapplication/chat/ContactInfo.class differ
diff --git a/bin/collegeapplication/chat/ContactListPanel$1.class b/bin/collegeapplication/chat/ContactListPanel$1.class
new file mode 100644
index 0000000..5bebda1
Binary files /dev/null and b/bin/collegeapplication/chat/ContactListPanel$1.class differ
diff --git a/bin/collegeapplication/chat/ContactListPanel.class b/bin/collegeapplication/chat/ContactListPanel.class
new file mode 100644
index 0000000..8fd70a3
Binary files /dev/null and b/bin/collegeapplication/chat/ContactListPanel.class differ
diff --git a/bin/collegeapplication/chat/Group.class b/bin/collegeapplication/chat/Group.class
new file mode 100644
index 0000000..a58b85f
Binary files /dev/null and b/bin/collegeapplication/chat/Group.class differ
diff --git a/bin/collegeapplication/chat/MessageStatus.class b/bin/collegeapplication/chat/MessageStatus.class
new file mode 100644
index 0000000..4274497
Binary files /dev/null and b/bin/collegeapplication/chat/MessageStatus.class differ
diff --git a/bin/collegeapplication/chat/NewMessage.class b/bin/collegeapplication/chat/NewMessage.class
new file mode 100644
index 0000000..b8b05d3
Binary files /dev/null and b/bin/collegeapplication/chat/NewMessage.class differ
diff --git a/bin/collegeapplication/chat/RoundedCornerBorder.class b/bin/collegeapplication/chat/RoundedCornerBorder.class
new file mode 100644
index 0000000..c7aaa3a
Binary files /dev/null and b/bin/collegeapplication/chat/RoundedCornerBorder.class differ
diff --git a/bin/collegeapplication/chat/Server.class b/bin/collegeapplication/chat/Server.class
new file mode 100644
index 0000000..03e6967
Binary files /dev/null and b/bin/collegeapplication/chat/Server.class differ
diff --git a/bin/collegeapplication/chat/SubChatPanel$1.class b/bin/collegeapplication/chat/SubChatPanel$1.class
new file mode 100644
index 0000000..e27565e
Binary files /dev/null and b/bin/collegeapplication/chat/SubChatPanel$1.class differ
diff --git a/bin/collegeapplication/chat/SubChatPanel$2.class b/bin/collegeapplication/chat/SubChatPanel$2.class
new file mode 100644
index 0000000..3b46a04
Binary files /dev/null and b/bin/collegeapplication/chat/SubChatPanel$2.class differ
diff --git a/bin/collegeapplication/chat/SubChatPanel$3.class b/bin/collegeapplication/chat/SubChatPanel$3.class
new file mode 100644
index 0000000..3c2801e
Binary files /dev/null and b/bin/collegeapplication/chat/SubChatPanel$3.class differ
diff --git a/bin/collegeapplication/chat/SubChatPanel$4.class b/bin/collegeapplication/chat/SubChatPanel$4.class
new file mode 100644
index 0000000..ff9561e
Binary files /dev/null and b/bin/collegeapplication/chat/SubChatPanel$4.class differ
diff --git a/bin/collegeapplication/chat/SubChatPanel$5.class b/bin/collegeapplication/chat/SubChatPanel$5.class
new file mode 100644
index 0000000..987f715
Binary files /dev/null and b/bin/collegeapplication/chat/SubChatPanel$5.class differ
diff --git a/bin/collegeapplication/chat/SubChatPanel$MessageStatusActionListener.class b/bin/collegeapplication/chat/SubChatPanel$MessageStatusActionListener.class
new file mode 100644
index 0000000..6980a96
Binary files /dev/null and b/bin/collegeapplication/chat/SubChatPanel$MessageStatusActionListener.class differ
diff --git a/bin/collegeapplication/chat/SubChatPanel$MyDocumentListener.class b/bin/collegeapplication/chat/SubChatPanel$MyDocumentListener.class
new file mode 100644
index 0000000..610cd4c
Binary files /dev/null and b/bin/collegeapplication/chat/SubChatPanel$MyDocumentListener.class differ
diff --git a/bin/collegeapplication/chat/SubChatPanel.class b/bin/collegeapplication/chat/SubChatPanel.class
new file mode 100644
index 0000000..a340469
Binary files /dev/null and b/bin/collegeapplication/chat/SubChatPanel.class differ
diff --git a/bin/collegeapplication/common/ChangePasswordDialog.class b/bin/collegeapplication/common/ChangePasswordDialog.class
new file mode 100644
index 0000000..a7d8fbb
Binary files /dev/null and b/bin/collegeapplication/common/ChangePasswordDialog.class differ
diff --git a/bin/collegeapplication/common/DataBaseConnection.class b/bin/collegeapplication/common/DataBaseConnection.class
new file mode 100644
index 0000000..b04e48c
Binary files /dev/null and b/bin/collegeapplication/common/DataBaseConnection.class differ
diff --git a/bin/collegeapplication/common/HintPasswordField$1.class b/bin/collegeapplication/common/HintPasswordField$1.class
new file mode 100644
index 0000000..2c81cda
Binary files /dev/null and b/bin/collegeapplication/common/HintPasswordField$1.class differ
diff --git a/bin/collegeapplication/common/HintPasswordField$2.class b/bin/collegeapplication/common/HintPasswordField$2.class
new file mode 100644
index 0000000..093535f
Binary files /dev/null and b/bin/collegeapplication/common/HintPasswordField$2.class differ
diff --git a/bin/collegeapplication/common/HintPasswordField$MyDocumentListener.class b/bin/collegeapplication/common/HintPasswordField$MyDocumentListener.class
new file mode 100644
index 0000000..19b8a75
Binary files /dev/null and b/bin/collegeapplication/common/HintPasswordField$MyDocumentListener.class differ
diff --git a/bin/collegeapplication/common/HintPasswordField.class b/bin/collegeapplication/common/HintPasswordField.class
new file mode 100644
index 0000000..7b1bbda
Binary files /dev/null and b/bin/collegeapplication/common/HintPasswordField.class differ
diff --git a/bin/collegeapplication/common/HintTextField$1.class b/bin/collegeapplication/common/HintTextField$1.class
new file mode 100644
index 0000000..813957c
Binary files /dev/null and b/bin/collegeapplication/common/HintTextField$1.class differ
diff --git a/bin/collegeapplication/common/HintTextField$2.class b/bin/collegeapplication/common/HintTextField$2.class
new file mode 100644
index 0000000..34e213a
Binary files /dev/null and b/bin/collegeapplication/common/HintTextField$2.class differ
diff --git a/bin/collegeapplication/common/HintTextField$MyDocumentListener.class b/bin/collegeapplication/common/HintTextField$MyDocumentListener.class
new file mode 100644
index 0000000..6eb0dba
Binary files /dev/null and b/bin/collegeapplication/common/HintTextField$MyDocumentListener.class differ
diff --git a/bin/collegeapplication/common/HintTextField.class b/bin/collegeapplication/common/HintTextField.class
new file mode 100644
index 0000000..304b032
Binary files /dev/null and b/bin/collegeapplication/common/HintTextField.class differ
diff --git a/bin/collegeapplication/common/HomePanel.class b/bin/collegeapplication/common/HomePanel.class
new file mode 100644
index 0000000..f8cb3e8
Binary files /dev/null and b/bin/collegeapplication/common/HomePanel.class differ
diff --git a/bin/collegeapplication/common/ImageUtil.class b/bin/collegeapplication/common/ImageUtil.class
new file mode 100644
index 0000000..2cc4f2c
Binary files /dev/null and b/bin/collegeapplication/common/ImageUtil.class differ
diff --git a/bin/collegeapplication/common/Notification.class b/bin/collegeapplication/common/Notification.class
new file mode 100644
index 0000000..ac77714
Binary files /dev/null and b/bin/collegeapplication/common/Notification.class differ
diff --git a/bin/collegeapplication/common/NotificationData.class b/bin/collegeapplication/common/NotificationData.class
new file mode 100644
index 0000000..51bafea
Binary files /dev/null and b/bin/collegeapplication/common/NotificationData.class differ
diff --git a/bin/collegeapplication/common/NotificationPanel$1.class b/bin/collegeapplication/common/NotificationPanel$1.class
new file mode 100644
index 0000000..4460ceb
Binary files /dev/null and b/bin/collegeapplication/common/NotificationPanel$1.class differ
diff --git a/bin/collegeapplication/common/NotificationPanel$2.class b/bin/collegeapplication/common/NotificationPanel$2.class
new file mode 100644
index 0000000..75b973b
Binary files /dev/null and b/bin/collegeapplication/common/NotificationPanel$2.class differ
diff --git a/bin/collegeapplication/common/NotificationPanel.class b/bin/collegeapplication/common/NotificationPanel.class
new file mode 100644
index 0000000..d552f46
Binary files /dev/null and b/bin/collegeapplication/common/NotificationPanel.class differ
diff --git a/bin/collegeapplication/common/Person.class b/bin/collegeapplication/common/Person.class
new file mode 100644
index 0000000..5ee63db
Binary files /dev/null and b/bin/collegeapplication/common/Person.class differ
diff --git a/bin/collegeapplication/common/PhotoViewPanel$1.class b/bin/collegeapplication/common/PhotoViewPanel$1.class
new file mode 100644
index 0000000..fb6f940
Binary files /dev/null and b/bin/collegeapplication/common/PhotoViewPanel$1.class differ
diff --git a/bin/collegeapplication/common/PhotoViewPanel$2.class b/bin/collegeapplication/common/PhotoViewPanel$2.class
new file mode 100644
index 0000000..bf5eff3
Binary files /dev/null and b/bin/collegeapplication/common/PhotoViewPanel$2.class differ
diff --git a/bin/collegeapplication/common/PhotoViewPanel.class b/bin/collegeapplication/common/PhotoViewPanel.class
new file mode 100644
index 0000000..e8d758e
Binary files /dev/null and b/bin/collegeapplication/common/PhotoViewPanel.class differ
diff --git a/bin/collegeapplication/common/PrintMarksheetDialog$1.class b/bin/collegeapplication/common/PrintMarksheetDialog$1.class
new file mode 100644
index 0000000..5d05ca9
Binary files /dev/null and b/bin/collegeapplication/common/PrintMarksheetDialog$1.class differ
diff --git a/bin/collegeapplication/common/PrintMarksheetDialog$2.class b/bin/collegeapplication/common/PrintMarksheetDialog$2.class
new file mode 100644
index 0000000..6f21140
Binary files /dev/null and b/bin/collegeapplication/common/PrintMarksheetDialog$2.class differ
diff --git a/bin/collegeapplication/common/PrintMarksheetDialog$3$1.class b/bin/collegeapplication/common/PrintMarksheetDialog$3$1.class
new file mode 100644
index 0000000..f85e534
Binary files /dev/null and b/bin/collegeapplication/common/PrintMarksheetDialog$3$1.class differ
diff --git a/bin/collegeapplication/common/PrintMarksheetDialog$3.class b/bin/collegeapplication/common/PrintMarksheetDialog$3.class
new file mode 100644
index 0000000..b02b99f
Binary files /dev/null and b/bin/collegeapplication/common/PrintMarksheetDialog$3.class differ
diff --git a/bin/collegeapplication/common/PrintMarksheetDialog.class b/bin/collegeapplication/common/PrintMarksheetDialog.class
new file mode 100644
index 0000000..8e326a7
Binary files /dev/null and b/bin/collegeapplication/common/PrintMarksheetDialog.class differ
diff --git a/bin/collegeapplication/common/ScrollPaneUtil$1.class b/bin/collegeapplication/common/ScrollPaneUtil$1.class
new file mode 100644
index 0000000..880ba3c
Binary files /dev/null and b/bin/collegeapplication/common/ScrollPaneUtil$1.class differ
diff --git a/bin/collegeapplication/common/ScrollPaneUtil.class b/bin/collegeapplication/common/ScrollPaneUtil.class
new file mode 100644
index 0000000..cac074e
Binary files /dev/null and b/bin/collegeapplication/common/ScrollPaneUtil.class differ
diff --git a/bin/collegeapplication/common/SearchPanel$1.class b/bin/collegeapplication/common/SearchPanel$1.class
new file mode 100644
index 0000000..5c951a8
Binary files /dev/null and b/bin/collegeapplication/common/SearchPanel$1.class differ
diff --git a/bin/collegeapplication/common/SearchPanel$2.class b/bin/collegeapplication/common/SearchPanel$2.class
new file mode 100644
index 0000000..b75729d
Binary files /dev/null and b/bin/collegeapplication/common/SearchPanel$2.class differ
diff --git a/bin/collegeapplication/common/SearchPanel$3.class b/bin/collegeapplication/common/SearchPanel$3.class
new file mode 100644
index 0000000..2a8efbc
Binary files /dev/null and b/bin/collegeapplication/common/SearchPanel$3.class differ
diff --git a/bin/collegeapplication/common/SearchPanel$4.class b/bin/collegeapplication/common/SearchPanel$4.class
new file mode 100644
index 0000000..aeb3c69
Binary files /dev/null and b/bin/collegeapplication/common/SearchPanel$4.class differ
diff --git a/bin/collegeapplication/common/SearchPanel$5.class b/bin/collegeapplication/common/SearchPanel$5.class
new file mode 100644
index 0000000..9e35f61
Binary files /dev/null and b/bin/collegeapplication/common/SearchPanel$5.class differ
diff --git a/bin/collegeapplication/common/SearchPanel$6.class b/bin/collegeapplication/common/SearchPanel$6.class
new file mode 100644
index 0000000..6f70875
Binary files /dev/null and b/bin/collegeapplication/common/SearchPanel$6.class differ
diff --git a/bin/collegeapplication/common/SearchPanel$7.class b/bin/collegeapplication/common/SearchPanel$7.class
new file mode 100644
index 0000000..5ae27e9
Binary files /dev/null and b/bin/collegeapplication/common/SearchPanel$7.class differ
diff --git a/bin/collegeapplication/common/SearchPanel.class b/bin/collegeapplication/common/SearchPanel.class
new file mode 100644
index 0000000..afc4a23
Binary files /dev/null and b/bin/collegeapplication/common/SearchPanel.class differ
diff --git a/bin/collegeapplication/common/TimeUtil.class b/bin/collegeapplication/common/TimeUtil.class
new file mode 100644
index 0000000..4404479
Binary files /dev/null and b/bin/collegeapplication/common/TimeUtil.class differ
diff --git a/bin/collegeapplication/common/User.class b/bin/collegeapplication/common/User.class
new file mode 100644
index 0000000..3cf09d3
Binary files /dev/null and b/bin/collegeapplication/common/User.class differ
diff --git a/bin/collegeapplication/common/UserData.class b/bin/collegeapplication/common/UserData.class
new file mode 100644
index 0000000..e9dc680
Binary files /dev/null and b/bin/collegeapplication/common/UserData.class differ
diff --git a/bin/collegeapplication/common/UsersPanel$1.class b/bin/collegeapplication/common/UsersPanel$1.class
new file mode 100644
index 0000000..1a3f00a
Binary files /dev/null and b/bin/collegeapplication/common/UsersPanel$1.class differ
diff --git a/bin/collegeapplication/common/UsersPanel$CellRenderer.class b/bin/collegeapplication/common/UsersPanel$CellRenderer.class
new file mode 100644
index 0000000..8571662
Binary files /dev/null and b/bin/collegeapplication/common/UsersPanel$CellRenderer.class differ
diff --git a/bin/collegeapplication/common/UsersPanel.class b/bin/collegeapplication/common/UsersPanel.class
new file mode 100644
index 0000000..5ba3df6
Binary files /dev/null and b/bin/collegeapplication/common/UsersPanel.class differ
diff --git a/bin/collegeapplication/common/printMarksheetPDF.class b/bin/collegeapplication/common/printMarksheetPDF.class
new file mode 100644
index 0000000..d2243aa
Binary files /dev/null and b/bin/collegeapplication/common/printMarksheetPDF.class differ
diff --git a/bin/collegeapplication/cource/AddCourceDialog.class b/bin/collegeapplication/cource/AddCourceDialog.class
new file mode 100644
index 0000000..4c4d12c
Binary files /dev/null and b/bin/collegeapplication/cource/AddCourceDialog.class differ
diff --git a/bin/collegeapplication/cource/Cource.class b/bin/collegeapplication/cource/Cource.class
new file mode 100644
index 0000000..76850af
Binary files /dev/null and b/bin/collegeapplication/cource/Cource.class differ
diff --git a/bin/collegeapplication/cource/CourceData.class b/bin/collegeapplication/cource/CourceData.class
new file mode 100644
index 0000000..58b5eda
Binary files /dev/null and b/bin/collegeapplication/cource/CourceData.class differ
diff --git a/bin/collegeapplication/cource/CourcePanel.class b/bin/collegeapplication/cource/CourcePanel.class
new file mode 100644
index 0000000..212d594
Binary files /dev/null and b/bin/collegeapplication/cource/CourcePanel.class differ
diff --git a/bin/collegeapplication/cource/RollGeneratorDialog.class b/bin/collegeapplication/cource/RollGeneratorDialog.class
new file mode 100644
index 0000000..d17dc93
Binary files /dev/null and b/bin/collegeapplication/cource/RollGeneratorDialog.class differ
diff --git a/bin/collegeapplication/cource/RollGeneratorPanel$1.class b/bin/collegeapplication/cource/RollGeneratorPanel$1.class
new file mode 100644
index 0000000..f9fc48a
Binary files /dev/null and b/bin/collegeapplication/cource/RollGeneratorPanel$1.class differ
diff --git a/bin/collegeapplication/cource/RollGeneratorPanel$2.class b/bin/collegeapplication/cource/RollGeneratorPanel$2.class
new file mode 100644
index 0000000..51a69e4
Binary files /dev/null and b/bin/collegeapplication/cource/RollGeneratorPanel$2.class differ
diff --git a/bin/collegeapplication/cource/RollGeneratorPanel.class b/bin/collegeapplication/cource/RollGeneratorPanel.class
new file mode 100644
index 0000000..4b57e92
Binary files /dev/null and b/bin/collegeapplication/cource/RollGeneratorPanel.class differ
diff --git a/bin/collegeapplication/cource/RollNumberData.class b/bin/collegeapplication/cource/RollNumberData.class
new file mode 100644
index 0000000..5e256d9
Binary files /dev/null and b/bin/collegeapplication/cource/RollNumberData.class differ
diff --git a/bin/collegeapplication/faculty/AddFaculityDialog$1.class b/bin/collegeapplication/faculty/AddFaculityDialog$1.class
new file mode 100644
index 0000000..84dc28d
Binary files /dev/null and b/bin/collegeapplication/faculty/AddFaculityDialog$1.class differ
diff --git a/bin/collegeapplication/faculty/AddFaculityDialog$10.class b/bin/collegeapplication/faculty/AddFaculityDialog$10.class
new file mode 100644
index 0000000..865906e
Binary files /dev/null and b/bin/collegeapplication/faculty/AddFaculityDialog$10.class differ
diff --git a/bin/collegeapplication/faculty/AddFaculityDialog$11.class b/bin/collegeapplication/faculty/AddFaculityDialog$11.class
new file mode 100644
index 0000000..bba661d
Binary files /dev/null and b/bin/collegeapplication/faculty/AddFaculityDialog$11.class differ
diff --git a/bin/collegeapplication/faculty/AddFaculityDialog$12.class b/bin/collegeapplication/faculty/AddFaculityDialog$12.class
new file mode 100644
index 0000000..a2076f7
Binary files /dev/null and b/bin/collegeapplication/faculty/AddFaculityDialog$12.class differ
diff --git a/bin/collegeapplication/faculty/AddFaculityDialog$13.class b/bin/collegeapplication/faculty/AddFaculityDialog$13.class
new file mode 100644
index 0000000..4359b91
Binary files /dev/null and b/bin/collegeapplication/faculty/AddFaculityDialog$13.class differ
diff --git a/bin/collegeapplication/faculty/AddFaculityDialog$14.class b/bin/collegeapplication/faculty/AddFaculityDialog$14.class
new file mode 100644
index 0000000..0c36048
Binary files /dev/null and b/bin/collegeapplication/faculty/AddFaculityDialog$14.class differ
diff --git a/bin/collegeapplication/faculty/AddFaculityDialog$2.class b/bin/collegeapplication/faculty/AddFaculityDialog$2.class
new file mode 100644
index 0000000..422db98
Binary files /dev/null and b/bin/collegeapplication/faculty/AddFaculityDialog$2.class differ
diff --git a/bin/collegeapplication/faculty/AddFaculityDialog$3.class b/bin/collegeapplication/faculty/AddFaculityDialog$3.class
new file mode 100644
index 0000000..3db6c4e
Binary files /dev/null and b/bin/collegeapplication/faculty/AddFaculityDialog$3.class differ
diff --git a/bin/collegeapplication/faculty/AddFaculityDialog$4.class b/bin/collegeapplication/faculty/AddFaculityDialog$4.class
new file mode 100644
index 0000000..b3e77c7
Binary files /dev/null and b/bin/collegeapplication/faculty/AddFaculityDialog$4.class differ
diff --git a/bin/collegeapplication/faculty/AddFaculityDialog$5.class b/bin/collegeapplication/faculty/AddFaculityDialog$5.class
new file mode 100644
index 0000000..2ca76d6
Binary files /dev/null and b/bin/collegeapplication/faculty/AddFaculityDialog$5.class differ
diff --git a/bin/collegeapplication/faculty/AddFaculityDialog$6.class b/bin/collegeapplication/faculty/AddFaculityDialog$6.class
new file mode 100644
index 0000000..ae35a3a
Binary files /dev/null and b/bin/collegeapplication/faculty/AddFaculityDialog$6.class differ
diff --git a/bin/collegeapplication/faculty/AddFaculityDialog$7.class b/bin/collegeapplication/faculty/AddFaculityDialog$7.class
new file mode 100644
index 0000000..61d23f6
Binary files /dev/null and b/bin/collegeapplication/faculty/AddFaculityDialog$7.class differ
diff --git a/bin/collegeapplication/faculty/AddFaculityDialog$8.class b/bin/collegeapplication/faculty/AddFaculityDialog$8.class
new file mode 100644
index 0000000..7750404
Binary files /dev/null and b/bin/collegeapplication/faculty/AddFaculityDialog$8.class differ
diff --git a/bin/collegeapplication/faculty/AddFaculityDialog$9.class b/bin/collegeapplication/faculty/AddFaculityDialog$9.class
new file mode 100644
index 0000000..571e028
Binary files /dev/null and b/bin/collegeapplication/faculty/AddFaculityDialog$9.class differ
diff --git a/bin/collegeapplication/faculty/AddFaculityDialog.class b/bin/collegeapplication/faculty/AddFaculityDialog.class
new file mode 100644
index 0000000..9cdc762
Binary files /dev/null and b/bin/collegeapplication/faculty/AddFaculityDialog.class differ
diff --git a/bin/collegeapplication/faculty/Faculty.class b/bin/collegeapplication/faculty/Faculty.class
new file mode 100644
index 0000000..52c7f37
Binary files /dev/null and b/bin/collegeapplication/faculty/Faculty.class differ
diff --git a/bin/collegeapplication/faculty/FacultyData.class b/bin/collegeapplication/faculty/FacultyData.class
new file mode 100644
index 0000000..d441195
Binary files /dev/null and b/bin/collegeapplication/faculty/FacultyData.class differ
diff --git a/bin/collegeapplication/faculty/FacultyMain$1.class b/bin/collegeapplication/faculty/FacultyMain$1.class
new file mode 100644
index 0000000..df54ccb
Binary files /dev/null and b/bin/collegeapplication/faculty/FacultyMain$1.class differ
diff --git a/bin/collegeapplication/faculty/FacultyMain$2.class b/bin/collegeapplication/faculty/FacultyMain$2.class
new file mode 100644
index 0000000..34105bc
Binary files /dev/null and b/bin/collegeapplication/faculty/FacultyMain$2.class differ
diff --git a/bin/collegeapplication/faculty/FacultyMain$3.class b/bin/collegeapplication/faculty/FacultyMain$3.class
new file mode 100644
index 0000000..b315a5e
Binary files /dev/null and b/bin/collegeapplication/faculty/FacultyMain$3.class differ
diff --git a/bin/collegeapplication/faculty/FacultyMain.class b/bin/collegeapplication/faculty/FacultyMain.class
new file mode 100644
index 0000000..b8711e6
Binary files /dev/null and b/bin/collegeapplication/faculty/FacultyMain.class differ
diff --git a/bin/collegeapplication/faculty/FacultyPanel$1.class b/bin/collegeapplication/faculty/FacultyPanel$1.class
new file mode 100644
index 0000000..35d6acb
Binary files /dev/null and b/bin/collegeapplication/faculty/FacultyPanel$1.class differ
diff --git a/bin/collegeapplication/faculty/FacultyPanel$2.class b/bin/collegeapplication/faculty/FacultyPanel$2.class
new file mode 100644
index 0000000..d59baf7
Binary files /dev/null and b/bin/collegeapplication/faculty/FacultyPanel$2.class differ
diff --git a/bin/collegeapplication/faculty/FacultyPanel$3.class b/bin/collegeapplication/faculty/FacultyPanel$3.class
new file mode 100644
index 0000000..3e3e812
Binary files /dev/null and b/bin/collegeapplication/faculty/FacultyPanel$3.class differ
diff --git a/bin/collegeapplication/faculty/FacultyPanel$4.class b/bin/collegeapplication/faculty/FacultyPanel$4.class
new file mode 100644
index 0000000..9e316e3
Binary files /dev/null and b/bin/collegeapplication/faculty/FacultyPanel$4.class differ
diff --git a/bin/collegeapplication/faculty/FacultyPanel.class b/bin/collegeapplication/faculty/FacultyPanel.class
new file mode 100644
index 0000000..d788d2b
Binary files /dev/null and b/bin/collegeapplication/faculty/FacultyPanel.class differ
diff --git a/bin/collegeapplication/faculty/ViewFacultyPanel$1.class b/bin/collegeapplication/faculty/ViewFacultyPanel$1.class
new file mode 100644
index 0000000..b8acc7d
Binary files /dev/null and b/bin/collegeapplication/faculty/ViewFacultyPanel$1.class differ
diff --git a/bin/collegeapplication/faculty/ViewFacultyPanel$2.class b/bin/collegeapplication/faculty/ViewFacultyPanel$2.class
new file mode 100644
index 0000000..29ef275
Binary files /dev/null and b/bin/collegeapplication/faculty/ViewFacultyPanel$2.class differ
diff --git a/bin/collegeapplication/faculty/ViewFacultyPanel$3.class b/bin/collegeapplication/faculty/ViewFacultyPanel$3.class
new file mode 100644
index 0000000..33016e2
Binary files /dev/null and b/bin/collegeapplication/faculty/ViewFacultyPanel$3.class differ
diff --git a/bin/collegeapplication/faculty/ViewFacultyPanel$4.class b/bin/collegeapplication/faculty/ViewFacultyPanel$4.class
new file mode 100644
index 0000000..78348bd
Binary files /dev/null and b/bin/collegeapplication/faculty/ViewFacultyPanel$4.class differ
diff --git a/bin/collegeapplication/faculty/ViewFacultyPanel$5.class b/bin/collegeapplication/faculty/ViewFacultyPanel$5.class
new file mode 100644
index 0000000..6872937
Binary files /dev/null and b/bin/collegeapplication/faculty/ViewFacultyPanel$5.class differ
diff --git a/bin/collegeapplication/faculty/ViewFacultyPanel$6.class b/bin/collegeapplication/faculty/ViewFacultyPanel$6.class
new file mode 100644
index 0000000..0de2cca
Binary files /dev/null and b/bin/collegeapplication/faculty/ViewFacultyPanel$6.class differ
diff --git a/bin/collegeapplication/faculty/ViewFacultyPanel.class b/bin/collegeapplication/faculty/ViewFacultyPanel.class
new file mode 100644
index 0000000..f7df6c4
Binary files /dev/null and b/bin/collegeapplication/faculty/ViewFacultyPanel.class differ
diff --git a/bin/collegeapplication/login/LoginPageFrame$1.class b/bin/collegeapplication/login/LoginPageFrame$1.class
new file mode 100644
index 0000000..8849a00
Binary files /dev/null and b/bin/collegeapplication/login/LoginPageFrame$1.class differ
diff --git a/bin/collegeapplication/login/LoginPageFrame$2.class b/bin/collegeapplication/login/LoginPageFrame$2.class
new file mode 100644
index 0000000..7e63af5
Binary files /dev/null and b/bin/collegeapplication/login/LoginPageFrame$2.class differ
diff --git a/bin/collegeapplication/login/LoginPageFrame$3.class b/bin/collegeapplication/login/LoginPageFrame$3.class
new file mode 100644
index 0000000..185cdf6
Binary files /dev/null and b/bin/collegeapplication/login/LoginPageFrame$3.class differ
diff --git a/bin/collegeapplication/login/LoginPageFrame$4.class b/bin/collegeapplication/login/LoginPageFrame$4.class
new file mode 100644
index 0000000..78d7f8b
Binary files /dev/null and b/bin/collegeapplication/login/LoginPageFrame$4.class differ
diff --git a/bin/collegeapplication/login/LoginPageFrame$5.class b/bin/collegeapplication/login/LoginPageFrame$5.class
new file mode 100644
index 0000000..a5fd640
Binary files /dev/null and b/bin/collegeapplication/login/LoginPageFrame$5.class differ
diff --git a/bin/collegeapplication/login/LoginPageFrame.class b/bin/collegeapplication/login/LoginPageFrame.class
new file mode 100644
index 0000000..f622e34
Binary files /dev/null and b/bin/collegeapplication/login/LoginPageFrame.class differ
diff --git a/bin/collegeapplication/login/LoginPanel.class b/bin/collegeapplication/login/LoginPanel.class
new file mode 100644
index 0000000..7e7b340
Binary files /dev/null and b/bin/collegeapplication/login/LoginPanel.class differ
diff --git a/bin/collegeapplication/student/AddStudentDialog$1.class b/bin/collegeapplication/student/AddStudentDialog$1.class
new file mode 100644
index 0000000..0b2abf6
Binary files /dev/null and b/bin/collegeapplication/student/AddStudentDialog$1.class differ
diff --git a/bin/collegeapplication/student/AddStudentDialog$2.class b/bin/collegeapplication/student/AddStudentDialog$2.class
new file mode 100644
index 0000000..1588d8e
Binary files /dev/null and b/bin/collegeapplication/student/AddStudentDialog$2.class differ
diff --git a/bin/collegeapplication/student/AddStudentDialog$3.class b/bin/collegeapplication/student/AddStudentDialog$3.class
new file mode 100644
index 0000000..47f794c
Binary files /dev/null and b/bin/collegeapplication/student/AddStudentDialog$3.class differ
diff --git a/bin/collegeapplication/student/AddStudentDialog$4.class b/bin/collegeapplication/student/AddStudentDialog$4.class
new file mode 100644
index 0000000..6e1d8ad
Binary files /dev/null and b/bin/collegeapplication/student/AddStudentDialog$4.class differ
diff --git a/bin/collegeapplication/student/AddStudentDialog.class b/bin/collegeapplication/student/AddStudentDialog.class
new file mode 100644
index 0000000..bdbbf94
Binary files /dev/null and b/bin/collegeapplication/student/AddStudentDialog.class differ
diff --git a/bin/collegeapplication/student/Attandance.class b/bin/collegeapplication/student/Attandance.class
new file mode 100644
index 0000000..e0cca85
Binary files /dev/null and b/bin/collegeapplication/student/Attandance.class differ
diff --git a/bin/collegeapplication/student/AttandanceReportPanel$1.class b/bin/collegeapplication/student/AttandanceReportPanel$1.class
new file mode 100644
index 0000000..affc0e3
Binary files /dev/null and b/bin/collegeapplication/student/AttandanceReportPanel$1.class differ
diff --git a/bin/collegeapplication/student/AttandanceReportPanel$2.class b/bin/collegeapplication/student/AttandanceReportPanel$2.class
new file mode 100644
index 0000000..95a9235
Binary files /dev/null and b/bin/collegeapplication/student/AttandanceReportPanel$2.class differ
diff --git a/bin/collegeapplication/student/AttandanceReportPanel$3.class b/bin/collegeapplication/student/AttandanceReportPanel$3.class
new file mode 100644
index 0000000..c7e86ef
Binary files /dev/null and b/bin/collegeapplication/student/AttandanceReportPanel$3.class differ
diff --git a/bin/collegeapplication/student/AttandanceReportPanel$4.class b/bin/collegeapplication/student/AttandanceReportPanel$4.class
new file mode 100644
index 0000000..29c2197
Binary files /dev/null and b/bin/collegeapplication/student/AttandanceReportPanel$4.class differ
diff --git a/bin/collegeapplication/student/AttandanceReportPanel$5.class b/bin/collegeapplication/student/AttandanceReportPanel$5.class
new file mode 100644
index 0000000..ee62c32
Binary files /dev/null and b/bin/collegeapplication/student/AttandanceReportPanel$5.class differ
diff --git a/bin/collegeapplication/student/AttandanceReportPanel$6.class b/bin/collegeapplication/student/AttandanceReportPanel$6.class
new file mode 100644
index 0000000..9474558
Binary files /dev/null and b/bin/collegeapplication/student/AttandanceReportPanel$6.class differ
diff --git a/bin/collegeapplication/student/AttandanceReportPanel$7.class b/bin/collegeapplication/student/AttandanceReportPanel$7.class
new file mode 100644
index 0000000..b23fc95
Binary files /dev/null and b/bin/collegeapplication/student/AttandanceReportPanel$7.class differ
diff --git a/bin/collegeapplication/student/AttandanceReportPanel$8.class b/bin/collegeapplication/student/AttandanceReportPanel$8.class
new file mode 100644
index 0000000..4da4b1b
Binary files /dev/null and b/bin/collegeapplication/student/AttandanceReportPanel$8.class differ
diff --git a/bin/collegeapplication/student/AttandanceReportPanel$9.class b/bin/collegeapplication/student/AttandanceReportPanel$9.class
new file mode 100644
index 0000000..eeb97a6
Binary files /dev/null and b/bin/collegeapplication/student/AttandanceReportPanel$9.class differ
diff --git a/bin/collegeapplication/student/AttandanceReportPanel$CellRenderer.class b/bin/collegeapplication/student/AttandanceReportPanel$CellRenderer.class
new file mode 100644
index 0000000..6aadce8
Binary files /dev/null and b/bin/collegeapplication/student/AttandanceReportPanel$CellRenderer.class differ
diff --git a/bin/collegeapplication/student/AttandanceReportPanel.class b/bin/collegeapplication/student/AttandanceReportPanel.class
new file mode 100644
index 0000000..8070b23
Binary files /dev/null and b/bin/collegeapplication/student/AttandanceReportPanel.class differ
diff --git a/bin/collegeapplication/student/EnterMarksPanel$1.class b/bin/collegeapplication/student/EnterMarksPanel$1.class
new file mode 100644
index 0000000..04889dc
Binary files /dev/null and b/bin/collegeapplication/student/EnterMarksPanel$1.class differ
diff --git a/bin/collegeapplication/student/EnterMarksPanel$2.class b/bin/collegeapplication/student/EnterMarksPanel$2.class
new file mode 100644
index 0000000..4016485
Binary files /dev/null and b/bin/collegeapplication/student/EnterMarksPanel$2.class differ
diff --git a/bin/collegeapplication/student/EnterMarksPanel.class b/bin/collegeapplication/student/EnterMarksPanel.class
new file mode 100644
index 0000000..e4249c1
Binary files /dev/null and b/bin/collegeapplication/student/EnterMarksPanel.class differ
diff --git a/bin/collegeapplication/student/ForcedListSelectionModel.class b/bin/collegeapplication/student/ForcedListSelectionModel.class
new file mode 100644
index 0000000..cd91c0c
Binary files /dev/null and b/bin/collegeapplication/student/ForcedListSelectionModel.class differ
diff --git a/bin/collegeapplication/student/HeaderRendererForCheckBox$1.class b/bin/collegeapplication/student/HeaderRendererForCheckBox$1.class
new file mode 100644
index 0000000..5283a78
Binary files /dev/null and b/bin/collegeapplication/student/HeaderRendererForCheckBox$1.class differ
diff --git a/bin/collegeapplication/student/HeaderRendererForCheckBox$CheckBoxIcon.class b/bin/collegeapplication/student/HeaderRendererForCheckBox$CheckBoxIcon.class
new file mode 100644
index 0000000..ab4987f
Binary files /dev/null and b/bin/collegeapplication/student/HeaderRendererForCheckBox$CheckBoxIcon.class differ
diff --git a/bin/collegeapplication/student/HeaderRendererForCheckBox.class b/bin/collegeapplication/student/HeaderRendererForCheckBox.class
new file mode 100644
index 0000000..8d53403
Binary files /dev/null and b/bin/collegeapplication/student/HeaderRendererForCheckBox.class differ
diff --git a/bin/collegeapplication/student/MarkAttandancePanel$1.class b/bin/collegeapplication/student/MarkAttandancePanel$1.class
new file mode 100644
index 0000000..198e304
Binary files /dev/null and b/bin/collegeapplication/student/MarkAttandancePanel$1.class differ
diff --git a/bin/collegeapplication/student/MarkAttandancePanel.class b/bin/collegeapplication/student/MarkAttandancePanel.class
new file mode 100644
index 0000000..1e1dc37
Binary files /dev/null and b/bin/collegeapplication/student/MarkAttandancePanel.class differ
diff --git a/bin/collegeapplication/student/MarkSheetPanel$1.class b/bin/collegeapplication/student/MarkSheetPanel$1.class
new file mode 100644
index 0000000..edcc0bd
Binary files /dev/null and b/bin/collegeapplication/student/MarkSheetPanel$1.class differ
diff --git a/bin/collegeapplication/student/MarkSheetPanel$2.class b/bin/collegeapplication/student/MarkSheetPanel$2.class
new file mode 100644
index 0000000..fb783a9
Binary files /dev/null and b/bin/collegeapplication/student/MarkSheetPanel$2.class differ
diff --git a/bin/collegeapplication/student/MarkSheetPanel$3.class b/bin/collegeapplication/student/MarkSheetPanel$3.class
new file mode 100644
index 0000000..5c033aa
Binary files /dev/null and b/bin/collegeapplication/student/MarkSheetPanel$3.class differ
diff --git a/bin/collegeapplication/student/MarkSheetPanel$4.class b/bin/collegeapplication/student/MarkSheetPanel$4.class
new file mode 100644
index 0000000..4308218
Binary files /dev/null and b/bin/collegeapplication/student/MarkSheetPanel$4.class differ
diff --git a/bin/collegeapplication/student/MarkSheetPanel$5.class b/bin/collegeapplication/student/MarkSheetPanel$5.class
new file mode 100644
index 0000000..5bc46b9
Binary files /dev/null and b/bin/collegeapplication/student/MarkSheetPanel$5.class differ
diff --git a/bin/collegeapplication/student/MarkSheetPanel$6.class b/bin/collegeapplication/student/MarkSheetPanel$6.class
new file mode 100644
index 0000000..b38bc90
Binary files /dev/null and b/bin/collegeapplication/student/MarkSheetPanel$6.class differ
diff --git a/bin/collegeapplication/student/MarkSheetPanel$7.class b/bin/collegeapplication/student/MarkSheetPanel$7.class
new file mode 100644
index 0000000..75b6b77
Binary files /dev/null and b/bin/collegeapplication/student/MarkSheetPanel$7.class differ
diff --git a/bin/collegeapplication/student/MarkSheetPanel$CellRenderer.class b/bin/collegeapplication/student/MarkSheetPanel$CellRenderer.class
new file mode 100644
index 0000000..7f2b231
Binary files /dev/null and b/bin/collegeapplication/student/MarkSheetPanel$CellRenderer.class differ
diff --git a/bin/collegeapplication/student/MarkSheetPanel.class b/bin/collegeapplication/student/MarkSheetPanel.class
new file mode 100644
index 0000000..0e58d4b
Binary files /dev/null and b/bin/collegeapplication/student/MarkSheetPanel.class differ
diff --git a/bin/collegeapplication/student/MarkSheetReportPanel$1.class b/bin/collegeapplication/student/MarkSheetReportPanel$1.class
new file mode 100644
index 0000000..0c148e9
Binary files /dev/null and b/bin/collegeapplication/student/MarkSheetReportPanel$1.class differ
diff --git a/bin/collegeapplication/student/MarkSheetReportPanel$10.class b/bin/collegeapplication/student/MarkSheetReportPanel$10.class
new file mode 100644
index 0000000..b5f1242
Binary files /dev/null and b/bin/collegeapplication/student/MarkSheetReportPanel$10.class differ
diff --git a/bin/collegeapplication/student/MarkSheetReportPanel$2.class b/bin/collegeapplication/student/MarkSheetReportPanel$2.class
new file mode 100644
index 0000000..a261792
Binary files /dev/null and b/bin/collegeapplication/student/MarkSheetReportPanel$2.class differ
diff --git a/bin/collegeapplication/student/MarkSheetReportPanel$3.class b/bin/collegeapplication/student/MarkSheetReportPanel$3.class
new file mode 100644
index 0000000..1d0e4dd
Binary files /dev/null and b/bin/collegeapplication/student/MarkSheetReportPanel$3.class differ
diff --git a/bin/collegeapplication/student/MarkSheetReportPanel$4.class b/bin/collegeapplication/student/MarkSheetReportPanel$4.class
new file mode 100644
index 0000000..272066f
Binary files /dev/null and b/bin/collegeapplication/student/MarkSheetReportPanel$4.class differ
diff --git a/bin/collegeapplication/student/MarkSheetReportPanel$5.class b/bin/collegeapplication/student/MarkSheetReportPanel$5.class
new file mode 100644
index 0000000..5eaede5
Binary files /dev/null and b/bin/collegeapplication/student/MarkSheetReportPanel$5.class differ
diff --git a/bin/collegeapplication/student/MarkSheetReportPanel$6.class b/bin/collegeapplication/student/MarkSheetReportPanel$6.class
new file mode 100644
index 0000000..38e133e
Binary files /dev/null and b/bin/collegeapplication/student/MarkSheetReportPanel$6.class differ
diff --git a/bin/collegeapplication/student/MarkSheetReportPanel$7.class b/bin/collegeapplication/student/MarkSheetReportPanel$7.class
new file mode 100644
index 0000000..e17dc63
Binary files /dev/null and b/bin/collegeapplication/student/MarkSheetReportPanel$7.class differ
diff --git a/bin/collegeapplication/student/MarkSheetReportPanel$8.class b/bin/collegeapplication/student/MarkSheetReportPanel$8.class
new file mode 100644
index 0000000..e59b3ea
Binary files /dev/null and b/bin/collegeapplication/student/MarkSheetReportPanel$8.class differ
diff --git a/bin/collegeapplication/student/MarkSheetReportPanel$9.class b/bin/collegeapplication/student/MarkSheetReportPanel$9.class
new file mode 100644
index 0000000..9e31397
Binary files /dev/null and b/bin/collegeapplication/student/MarkSheetReportPanel$9.class differ
diff --git a/bin/collegeapplication/student/MarkSheetReportPanel$DeclareResult.class b/bin/collegeapplication/student/MarkSheetReportPanel$DeclareResult.class
new file mode 100644
index 0000000..206d4b4
Binary files /dev/null and b/bin/collegeapplication/student/MarkSheetReportPanel$DeclareResult.class differ
diff --git a/bin/collegeapplication/student/MarkSheetReportPanel$MouseAdapterForTable.class b/bin/collegeapplication/student/MarkSheetReportPanel$MouseAdapterForTable.class
new file mode 100644
index 0000000..376c9fd
Binary files /dev/null and b/bin/collegeapplication/student/MarkSheetReportPanel$MouseAdapterForTable.class differ
diff --git a/bin/collegeapplication/student/MarkSheetReportPanel.class b/bin/collegeapplication/student/MarkSheetReportPanel.class
new file mode 100644
index 0000000..30b9e25
Binary files /dev/null and b/bin/collegeapplication/student/MarkSheetReportPanel.class differ
diff --git a/bin/collegeapplication/student/Marks.class b/bin/collegeapplication/student/Marks.class
new file mode 100644
index 0000000..7d1da0c
Binary files /dev/null and b/bin/collegeapplication/student/Marks.class differ
diff --git a/bin/collegeapplication/student/RollNumberAvailableException.class b/bin/collegeapplication/student/RollNumberAvailableException.class
new file mode 100644
index 0000000..0b70145
Binary files /dev/null and b/bin/collegeapplication/student/RollNumberAvailableException.class differ
diff --git a/bin/collegeapplication/student/Student.class b/bin/collegeapplication/student/Student.class
new file mode 100644
index 0000000..0755d59
Binary files /dev/null and b/bin/collegeapplication/student/Student.class differ
diff --git a/bin/collegeapplication/student/StudentData.class b/bin/collegeapplication/student/StudentData.class
new file mode 100644
index 0000000..21f166a
Binary files /dev/null and b/bin/collegeapplication/student/StudentData.class differ
diff --git a/bin/collegeapplication/student/StudentMain$1.class b/bin/collegeapplication/student/StudentMain$1.class
new file mode 100644
index 0000000..7bc30b3
Binary files /dev/null and b/bin/collegeapplication/student/StudentMain$1.class differ
diff --git a/bin/collegeapplication/student/StudentMain$2.class b/bin/collegeapplication/student/StudentMain$2.class
new file mode 100644
index 0000000..9912bae
Binary files /dev/null and b/bin/collegeapplication/student/StudentMain$2.class differ
diff --git a/bin/collegeapplication/student/StudentMain$3.class b/bin/collegeapplication/student/StudentMain$3.class
new file mode 100644
index 0000000..df96d1b
Binary files /dev/null and b/bin/collegeapplication/student/StudentMain$3.class differ
diff --git a/bin/collegeapplication/student/StudentMain.class b/bin/collegeapplication/student/StudentMain.class
new file mode 100644
index 0000000..65743c3
Binary files /dev/null and b/bin/collegeapplication/student/StudentMain.class differ
diff --git a/bin/collegeapplication/student/StudentPanel$1.class b/bin/collegeapplication/student/StudentPanel$1.class
new file mode 100644
index 0000000..a7675ac
Binary files /dev/null and b/bin/collegeapplication/student/StudentPanel$1.class differ
diff --git a/bin/collegeapplication/student/StudentPanel$2.class b/bin/collegeapplication/student/StudentPanel$2.class
new file mode 100644
index 0000000..692404e
Binary files /dev/null and b/bin/collegeapplication/student/StudentPanel$2.class differ
diff --git a/bin/collegeapplication/student/StudentPanel.class b/bin/collegeapplication/student/StudentPanel.class
new file mode 100644
index 0000000..437ecd4
Binary files /dev/null and b/bin/collegeapplication/student/StudentPanel.class differ
diff --git a/bin/collegeapplication/student/ViewStudentDialog.class b/bin/collegeapplication/student/ViewStudentDialog.class
new file mode 100644
index 0000000..1db4136
Binary files /dev/null and b/bin/collegeapplication/student/ViewStudentDialog.class differ
diff --git a/bin/collegeapplication/student/ViewStudentPanel$1.class b/bin/collegeapplication/student/ViewStudentPanel$1.class
new file mode 100644
index 0000000..a448695
Binary files /dev/null and b/bin/collegeapplication/student/ViewStudentPanel$1.class differ
diff --git a/bin/collegeapplication/student/ViewStudentPanel$2.class b/bin/collegeapplication/student/ViewStudentPanel$2.class
new file mode 100644
index 0000000..3a828b7
Binary files /dev/null and b/bin/collegeapplication/student/ViewStudentPanel$2.class differ
diff --git a/bin/collegeapplication/student/ViewStudentPanel$3.class b/bin/collegeapplication/student/ViewStudentPanel$3.class
new file mode 100644
index 0000000..d1b495a
Binary files /dev/null and b/bin/collegeapplication/student/ViewStudentPanel$3.class differ
diff --git a/bin/collegeapplication/student/ViewStudentPanel$4.class b/bin/collegeapplication/student/ViewStudentPanel$4.class
new file mode 100644
index 0000000..691355b
Binary files /dev/null and b/bin/collegeapplication/student/ViewStudentPanel$4.class differ
diff --git a/bin/collegeapplication/student/ViewStudentPanel$5.class b/bin/collegeapplication/student/ViewStudentPanel$5.class
new file mode 100644
index 0000000..baea3c7
Binary files /dev/null and b/bin/collegeapplication/student/ViewStudentPanel$5.class differ
diff --git a/bin/collegeapplication/student/ViewStudentPanel$6.class b/bin/collegeapplication/student/ViewStudentPanel$6.class
new file mode 100644
index 0000000..1502425
Binary files /dev/null and b/bin/collegeapplication/student/ViewStudentPanel$6.class differ
diff --git a/bin/collegeapplication/student/ViewStudentPanel$7.class b/bin/collegeapplication/student/ViewStudentPanel$7.class
new file mode 100644
index 0000000..3b2172f
Binary files /dev/null and b/bin/collegeapplication/student/ViewStudentPanel$7.class differ
diff --git a/bin/collegeapplication/student/ViewStudentPanel.class b/bin/collegeapplication/student/ViewStudentPanel.class
new file mode 100644
index 0000000..0c30bb3
Binary files /dev/null and b/bin/collegeapplication/student/ViewStudentPanel.class differ
diff --git a/bin/collegeapplication/subject/AddSubjectDialog$1.class b/bin/collegeapplication/subject/AddSubjectDialog$1.class
new file mode 100644
index 0000000..a702d35
Binary files /dev/null and b/bin/collegeapplication/subject/AddSubjectDialog$1.class differ
diff --git a/bin/collegeapplication/subject/AddSubjectDialog$2.class b/bin/collegeapplication/subject/AddSubjectDialog$2.class
new file mode 100644
index 0000000..a1002dc
Binary files /dev/null and b/bin/collegeapplication/subject/AddSubjectDialog$2.class differ
diff --git a/bin/collegeapplication/subject/AddSubjectDialog$3.class b/bin/collegeapplication/subject/AddSubjectDialog$3.class
new file mode 100644
index 0000000..aa45297
Binary files /dev/null and b/bin/collegeapplication/subject/AddSubjectDialog$3.class differ
diff --git a/bin/collegeapplication/subject/AddSubjectDialog$4.class b/bin/collegeapplication/subject/AddSubjectDialog$4.class
new file mode 100644
index 0000000..44c01fa
Binary files /dev/null and b/bin/collegeapplication/subject/AddSubjectDialog$4.class differ
diff --git a/bin/collegeapplication/subject/AddSubjectDialog$5.class b/bin/collegeapplication/subject/AddSubjectDialog$5.class
new file mode 100644
index 0000000..31585c0
Binary files /dev/null and b/bin/collegeapplication/subject/AddSubjectDialog$5.class differ
diff --git a/bin/collegeapplication/subject/AddSubjectDialog$6.class b/bin/collegeapplication/subject/AddSubjectDialog$6.class
new file mode 100644
index 0000000..b49211c
Binary files /dev/null and b/bin/collegeapplication/subject/AddSubjectDialog$6.class differ
diff --git a/bin/collegeapplication/subject/AddSubjectDialog.class b/bin/collegeapplication/subject/AddSubjectDialog.class
new file mode 100644
index 0000000..d28f061
Binary files /dev/null and b/bin/collegeapplication/subject/AddSubjectDialog.class differ
diff --git a/bin/collegeapplication/subject/AssignSubjectDialog.class b/bin/collegeapplication/subject/AssignSubjectDialog.class
new file mode 100644
index 0000000..57edb2e
Binary files /dev/null and b/bin/collegeapplication/subject/AssignSubjectDialog.class differ
diff --git a/bin/collegeapplication/subject/AssignSubjectPanel$1.class b/bin/collegeapplication/subject/AssignSubjectPanel$1.class
new file mode 100644
index 0000000..e81d344
Binary files /dev/null and b/bin/collegeapplication/subject/AssignSubjectPanel$1.class differ
diff --git a/bin/collegeapplication/subject/AssignSubjectPanel.class b/bin/collegeapplication/subject/AssignSubjectPanel.class
new file mode 100644
index 0000000..38b43fe
Binary files /dev/null and b/bin/collegeapplication/subject/AssignSubjectPanel.class differ
diff --git a/bin/collegeapplication/subject/Subject.class b/bin/collegeapplication/subject/Subject.class
new file mode 100644
index 0000000..b761b0f
Binary files /dev/null and b/bin/collegeapplication/subject/Subject.class differ
diff --git a/bin/collegeapplication/subject/SubjectData.class b/bin/collegeapplication/subject/SubjectData.class
new file mode 100644
index 0000000..8505fc5
Binary files /dev/null and b/bin/collegeapplication/subject/SubjectData.class differ
diff --git a/bin/collegeapplication/subject/SubjectPanel.class b/bin/collegeapplication/subject/SubjectPanel.class
new file mode 100644
index 0000000..2cc9807
Binary files /dev/null and b/bin/collegeapplication/subject/SubjectPanel.class differ
diff --git a/collegedata.sql b/collegedata.sql
new file mode 100644
index 0000000..98f4530
--- /dev/null
+++ b/collegedata.sql
@@ -0,0 +1,339 @@
+-- phpMyAdmin SQL Dump
+-- version 5.0.1
+-- https://www.phpmyadmin.net/
+--
+-- Host: 127.0.0.1
+-- Generation Time: Oct 18, 2020 at 08:47 AM
+-- Server version: 10.4.11-MariaDB
+-- PHP Version: 7.4.3
+
+SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
+SET AUTOCOMMIT = 0;
+START TRANSACTION;
+SET time_zone = "+00:00";
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8mb4 */;
+
+--
+-- Database: `collagedata`
+--
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `admin`
+--
+
+CREATE TABLE `admin` (
+ `collagename` varchar(50) DEFAULT NULL,
+ `address` varchar(100) DEFAULT NULL,
+ `emailid` varchar(50) DEFAULT NULL,
+ `contactnumber` varchar(40) DEFAULT NULL,
+ `website` varchar(30) DEFAULT NULL,
+ `lastlogin` varchar(40) DEFAULT NULL,
+ `password` varchar(30) DEFAULT NULL,
+ `facebook` varchar(100) DEFAULT NULL,
+ `instagram` varchar(100) DEFAULT NULL,
+ `twitter` varchar(100) DEFAULT NULL,
+ `linkedin` varchar(100) DEFAULT NULL,
+ `logo` longblob DEFAULT NULL,
+ `activestatus` tinyint(4) DEFAULT 0
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+--
+-- Dumping data for table `admin`
+--
+
+INSERT INTO `admin` (`collagename`, `address`, `emailid`, `contactnumber`, `website`, `lastlogin`, `password`, `facebook`, `instagram`, `twitter`, `linkedin`, `logo`, `activestatus`) VALUES
+('Silveroak Collage of Engineering And Technology', 'Opp. Bhagwat Vidyapith, S. G. Road, Gota, Ahmedabad - 382481', 'info@silveroakuni.ac.in', '+91-79-66046300', 'https://silveroakuni.ac.in/', '18-Oct-2020 12:13:36 PM', 'admin', 'https://www.facebook.com/SilverOakUni/', 'https://www.instagram.com/silveroakuni/', 'https://twitter.com/silveroakuni', 'https://www.linkedin.com/company/silveroakuni', 0xffd8ffe000104a46494600010200000100010000ffdb004300080606070605080707070909080a0c140d0c0b0b0c1912130f141d1a1f1e1d1a1c1c20242e2720222c231c1c2837292c30313434341f27393d38323c2e333432ffdb0043010909090c0b0c180d0d1832211c213232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232ffc0001108010e00fa03012200021101031101ffc4001f0000010501010101010100000000000000000102030405060708090a0bffc400b5100002010303020403050504040000017d01020300041105122131410613516107227114328191a1082342b1c11552d1f02433627282090a161718191a25262728292a3435363738393a434445464748494a535455565758595a636465666768696a737475767778797a838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae1e2e3e4e5e6e7e8e9eaf1f2f3f4f5f6f7f8f9faffc4001f0100030101010101010101010000000000000102030405060708090a0bffc400b51100020102040403040705040400010277000102031104052131061241510761711322328108144291a1b1c109233352f0156272d10a162434e125f11718191a262728292a35363738393a434445464748494a535455565758595a636465666768696a737475767778797a82838485868788898a92939495969798999aa2a3a4a5a6a7a8a9aab2b3b4b5b6b7b8b9bac2c3c4c5c6c7c8c9cad2d3d4d5d6d7d8d9dae2e3e4e5e6e7e8e9eaf2f3f4f5f6f7f8f9faffda000c03010002110311003f00f7fa28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2801bc6296a262075207d6b2b5fd41f4ed1a7ba830d22212bdc66a652514dbe85420e72515bb355686f4af2cb73ac0b26d5e0d63cd910079610c49519ee3a7e18a477d46facdb56bcd5fecdbcb0863de54395ec003f85717d73fbafbf4d8eff00a86bf1ab6db3dfb58f57e29add3a5733e13d565bcd185c5fc80346594bb71b80ee6b5ad358b0be9da2b6ba8a4907508e09aeb8558ca2a5dce3a94270938b57b6e6ad14515a19051451400514514005145140051451400514514005145140051451400514514005145140051451400514514011f6e9513b6c52d595e21d7a2d12c44a577cce76c7183f78ff0085734354f18ca8658eda1d98dc22dbf363e99ae7a9888c1f2d9b7e47550c24aac79ae92f376b905c0b9f16ea97bbae9a1d3ed73f7791c77c7ad53d2e48acf51b7b286ecde69d7a363230231938e54f43577c1534664d474cbb1b1ee39d8dc13c608ad6d3bc2da668177f6d9ae8b6cff57e69002ff89ae2519545192defabbedaedf71df5650a6e507b24b9525be9bdfd4c5d47ec5a24f71a5691692cf733a01292c5b60ea00fcf3f8d67e9cf6f6c63d3f5db39040097859810509c647d381d2b52fe2d4edbc4971aae936e9791dc2800ae0ed3803079f6ad3f18849bc2c935ca2a5ca94207a31ea3f9fe5438bf7a4b4e5be96d2dff0004b8cd2e4a6f5e6b5ddf54ff004b1cfe175b6919dfec5a1d99da028e0f381c0ea4d5bd6fc3f63a76949ab6953ba326d747f309c827a8f7ad7f0ee9f06a1e0a164d81e7212f8eb9cf07f4158b3787ae6d2dd23d5f5611e9909f9547523d00edfad524f9399abdd6fd9fe8911cebdab8a765176b6f75fab659d43c557b73a769d6f6584bbba8d5d9bd33e955ac3c47aa69f2c32dd4e97762f27945d3276b77e4f3fe353ea10691adc30be957696f35a47b578e882b9b0e3ec1f60b2496e57cef3a69026031030028ec302b39549c65cdcde967fa7e668a853953b72db5d535aabf99ec30bacb1ab8390c320fa8a9f35cc786fc496ba92a58f96f05cc280794fe8063835d38af4e9d48ce374cf1aad274e6e2d598fa28a2b4330a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2800a28a2801b4527b562f8875b5d134e33eddf231da8bea6a273508b93d9154e12a92508ad5981e3b89e2bad2f50642f04121120f4c9523f91acb8b557bff18d9cfa6cb3ba4985923604285efc7a62a5babaf139b5379776d0cb6cc37340caa7e5f71d6a2b5d76691c8f0f68f144426e9595475f4ff3cd7995269cb9b55769dadae9d8f6e8d2946972d94ac9abdd595fb9a7e33d3dad5e0d72c9764f0b0f308efcf04d64788efe2d46fb4f9ee8caba6cb0ac8020f5e4fe35af36bffdb7e0cd4da588473c7132baf6dd8e31593a778b60d3f4486c9ad8cf2c60fde0368e78f7a75254dc9d9da3249fcd3ec4d185450578de516d6fd1aefe5d09ac17fe11ff00135a4169348f677918708fd81cf6f5e299aacf378a75f92ca197cab0b6c9673f7463ab1f7ea07d2a2d16ed354d5e5d4afaea313a2110c39c738e31daadf84ed7ed965acc0ac16e24c2e7fefafeb9a887be9463f0b6ddbd16c6b38fb36e73f8a292bf9b7bf9d9152ef4d6d0ac63d5f46d4dee204701be6057ae3b70464feb563c437697ba9e91737c1bfb3dd039c74ebcd50962d5a0d28e893dac56d019773ccce141e47393d7a03c735bd73ae787934586c2765b930a00a8232791e848c5545c5c5af8569a3daff3336e4a5195b99ddabadecd68eeb4b981acc7a6df5cdb49a4828b33981d402067d71f4aded5e66f0c4165a6e8e8ab3ce399580ebea49f5359fe1fd39b5bd5a2b94b516d616c73126dc063fd4fa9adcf19c9a2b410c17f2b473f2d118c65947afd29c22f9253564decf6f5b7a855a8bdac293bb4af75bfa5fbd8c5bb474f17e97297437b20fde88fa13cf3c7b67f2af4704127d6bcd34dbbd0fc3fb3515b996fe790108a1305077eb5db68baf59eb9017b62432fdf8dbaad6d859c754dabbd6c7363e13b45a8be58ab5ed6ebdbb1b745145779e605145140051451400514514005145140051451400514514005145140051451400cdb5cb78cf4c9750d3a192df1e75bc9bc213f7bfce2ba8cd703e339e79b5bb4d3bed0d6d6cebb9a40db46492393f80fceb9f10d2a6d357b9d1848c9d68b8bb5b529dbc7aceada90bab8b57b6822b6689c16f95ce0f6fa9fd29de19d33fb4bc3d7b6b6f73f66b9f3f2cea32700f1f875aa7733df5b083428b5412b4b29dd286394538c2e7afa9fca96d748b88757b8b4d1f51916ee11fbc0e3686f5c763d7bd79c9fbeb46f74f55bb5d0f66517ecdae651d9ad1dac9eec76a9a4c9a5a5ae890cde64f792079df181d7038f41d6b6278b44874163a6bc32bd9bac8fce59b079cfad645e586aba25f5b6b37d27da8abfef7073b47a67b5436d15aea3accafa4c0f1daac0de6e738e9ef4e2f964fddb37a59ee9791128de316e774b56d6cddf54fe5b1d75f784b4cd4a3f3628fc8988cac91f1f98ae5747d3b5bd27c472d95b3209248f2f2b72bb33c3e3d7af15dee88e6e344b199bef3c08c7f15154bfe67c7c7fcf92ff00e846bae7421271947477e87153c54e2a706f9959efaec491685676b1b5cde16bb9c02cd2cc73d3d07415c4de69fa75c6852de2488ba8aaf9d22038f949e98aef3c412bc7a06a122fde581f6fd769ae7f51f08da5c4497b2debdac6215f3b0401803af35388a57f76314f4fcfa860711caf9a526aeff2e96f331b4cbdd5fc3d696d7c3f7fa6caa094fee67b7b7d6b42f5f4ad6b538758fed28e38a250b2c322e4f19e31f8d6c5adce8da968571a6d848248a18766d3d400383ffd7af39d3d6de17867bfb6335abe570188f980f51f87e75cb51fb2518a7cd17f835fa1e8d18aaf29d469c66b4d12bb4fc9f53534e5297b7faa58e9fe7dbc4c0451b0e002793ef8c7fe3d5bde0eb7b9975abad4fecc6dada54dab19e99241e3f23f9d6659b6b97312c9657105843213e4dbfca37fd33c9fa9aea7c2baccfa82cf6778a16f2d8e1b031b87aff9f5aba118f3c6f75d76d1b31c5ce6a94ac93d93d5b6979f4dceae8a28af58f0c28a28a0028a28a0028a28a0028a28a0028a28a0028a28a0028a28a0028a28a008faf18ac3f1169363a8d8192ffe558016120382a2b74fd6b235fb09751d12eada16c4922617eb59d5578356bf91ad0938d58b4edaefd8e02c6cf45d59bec562f35bde2b6f8e794e43e3b71d3d692f637d0ad26ba5d4c5c6a531f259a27dc635ea4fae78c7e355aea6bfb3d2d207d385b3c20c6d718f988249c568cba67878e932246ecf7b1c1e733a9e4f1fe35e64573269249dbd3f0efe67b8f469c9b716f6d1fdefa27d8b1a6786b53d3f53b39a16335accbbae1891b707a823bd6cebbad69ba1446ce08835c480811440719f5ae52c6f35e6b5b7b78efe3822978844cf8623db83fad49e1f8ee16e751bf4845e5edb9d881f9cb773442af2c79229abf7d6da7426a50726e72927cbd1697d74bf41f63e27d7346b486396c58db46a157cc88a600f7c54e3c45711df3eb3f626f2dadd62cef5c6edc4fae7bf4eb5a29e29b7bcf0f5d49a85b059a1631345d99bb63d3bfe55cddaf87359bdb1cc51a476aee6448a4908e4fa71e949caa2b2a7272d2fe828c2949ca53828bbd9eba3f4350ea9e23f115abc56d68ab68e30c703047b138cfe145fea7aa5d59dc6837f6de5dd140d115c7ce179c71c72054d06b37d6d1c9a16a708b59a48cc76f320c28246067fc6abdb695a968f2aea7aa6d68ace33e5a87c973d867d3343726b46ddfe2f2efa0d28c5eb18ab6b1b6edf469f5f32adaeb71db696da769da63a6a32c62395c2f27dfd7f3ab1ac68634af095a49301e7f9c19fd8b751f9003f0ab3a4ebf7e755b46bdb280417a7f74d1a61803d0e6a5f1f5fab0b5d3e2f99c1f31d4761dbfad6968f239b77b2b2d2c65cd3f6b1a7156bbbb77bdfe7e451d52c6f6df52b1d4e0b17b881204088b9c2b01dc0e7bd6ef84f4fbc4bbbed53508bc99ae8fcb1f703b9fd0572d3eb93eeb4bbb2d4c96511a7d900e411d7f03c7e75ea1033bc11bb70cca091e87157868c673724f6d7cb5231952a53a4a124b5d2fadec9dedff04bb451457a279014514500145145001451450014514500145645cebb696f74d6c825b89d465d2142db7ea7a0a8e1f11e9b73770da248e2e6462be53c65594804f391ed401b745625cf8ab48b398c37370f1483b342e3fa53d3c4da6496ad72924cd02f59040f8fe5401b14560c3e2fd16e2558e1ba791dba2ac2e49fd2afde6a36fa7dafda2e0bac5c722366c7d401c5005fa2b022f1768b70e2386e5e473d1521724fe00569dd5f43696fe7cbe66cff00663663f9019a00b94562c5e28d2e6b76b88a599e15eaeb6ee47f2a893c63a1cae123bb6763d1561724fe9401a179636f7f6cf6f731abc6e3041ef581ff00084e9b6f6d3476eacaf2c6630ecc4edeff00cc0abb2f8ab48b6204f712c44f4124122e7f31562f75cd3f4f8e392ea5748e400abf94c579f702b39d284dddad4d69d7a94d5a2da47123c2baedd3dad95cc71adbdbb6167046427a0abf73a1eb5a3ea335c68db648ae092e871f293edf5ade8fc57a4cfbbc89e5936f2765bc8d8fc855cd3b57d3f5107ec9769211d57a1fc8f3582c2412d1bbf7ea74bc7d56f54addada3bea79fea3e1dbdd33455bbbbfde4ad73e74cabce01c75fc73f9d5ef10ebf69a858582e9572eb74255c47192b8e3a1c7be2bbe91164428e032918208eb58575a7787b42cea525b430b2f2a42f39ff00647ad672a0e17e4764d6b7f2ea5d3c52aad73c5b926ed6d9dfa58c7f1d228d02ca5938b90ea07ae769c8ff003e95d04d63fda9e1f16d392ad24014b7a1c75ae6ace0baf196b097f711b45a6db366246fe33fe7ad77a8a02803a55d18a9394eda3d3d7cc9c44dd384217f7a2db7e57e879f4367e2ad2e34b38ada19d23f96290a82547b1ed5a9a0785a782ea4d4756712ddc808da7e60a0f5aeae4748632d23aa228c9627005650f11e9d3ef4b5335d6c38630c4cc07e38c55430d18b4db6edb5c5531d525171514afbb4b56450785f47b6bafb545649e6e720924807d813815d00185e056569fae69fa84ad15bce3ce5e0c4e0ab0fc0d6bd74461187c2ac71cea4e6ef26dfa8b45519b54b68353b7d3e47c4f3a9641f4abd54485158b77e26d2b4fb8305d4ef1483b342fcfd0e39a9ac75ab1d4a2925b49249238c64b794c01fa6473f85006a515823c59a399bece2794cd9c797f679377e58cd6cc6e248d5c670c3232307f2a00968a28a002ab5e33c7673bc632eb1b15fae2acd452c89144f248404504b13e9401e75e0bf115bd94d716fa836c92e24f33ce6fef7706babbbd1e1bbd674ed5adcc7be173e6303f7d4a91f9e48ac2d6fc129a8b7f6869322af9c37f94df75b3ce41ed58fe1cd4eff0042d7e3d3aeb788a47113c4c7ee927008fc6981a1f12147daac9b033b1b9fc6ba8d0d17fe10eb21b460d9a9231d7e5ae63e24ff00c7c58ffb8dfcebaad0ff00e44fb1ff00af35ff00d06901c2fc3c5075ec9009101c7e95e9d2469344d1c8a19181041ee2bccbe1dffc878ffd703fd2bd44900124e00a181e4f69bbc33e36547ff56b2ec24ff71b8cfe19fd2bd0f5dbd6b4d16678799e51e5c23d5db81fa9ae4bc7f651dc436babdb90d1b662765efe87f423f1abda25fb788a7d2d1ce459279b3fbc8385ff001fc2981d1d9e9f169ba3a59c606c8e2da4e3ef1c7535e6fe0903fe12a846060237f4af559bfd449fee9fe55e49e14b6fb5f88921f3648b28df34670474a00efb54b7b5f1045a869bb10c9022ed933d1ce703f41f9d33c53098fc133c6e0168e38c1fa86514cf0ce9afa4ea3ab5b3cad2e5924577392c0eeebf91a97c5b2c73784af9a37570368241cf3bd690193f0e141b1be2403fbc51fa573d74c6d3c7127f66707ed18013a139e47d339a76871ea83c39a95c69b772466361e644aa0ee5c72738c838f4ad0f00c96125f4ab3c40dffde8e5624923bf5ef4c0eee5912085e590e1114927d8579c99975ebdb9d635390a69b6cd88a21fc67b01fccfd6bb7f10079343be11e77794718ae1a4b77b8f04e9d2dbc665104c5e745efc9e4fe181f8d706264dcb97a257f53d0c2422a0e77b36d2bf656fd4d383c662dbcbdda4cb158f45901e83e98feb5da59ddc37d6d1dc5bb878a4195615ce699a85a6bfe1f981b60b02a98d91c71d3b547f0fe573a45c464feee39885fc6aa8cdc6718b774d69f20af4a12a729c559c5a4f5bdeff00a943e206af29ba8f4b85caa050d281dc9e82babf0ed847a7685690a280c630ee7d588c9fe75c0f8e6368fc5323b03b5d108fc0015e9b60c1ec2d9d4e4344a47e42bb4f3ce0bc776bfd9fab59ea36a7ca964072cbc7ccb8e7f5fd2bb2d0751fed4d1adeedb8765c38f715cc7c4a61e569c9fc459cff00e835269172da57c3ff003f38925cac58eb963b463f9fe1401cef88f53b93e255d4e305511ffd1cf66087ad7a858ddc77d650dd447292a071f8d703e233a7dc7872da1b549bceb40305a22323bf3fad697c3dd4fceb0974e76cb407727fba7ffaf4015fe2481b34e3819cb8cfe55a1a4ea09a7785f4e8a1557bc9d4ac31671b9b2793ec2a87c4aff57a77fbcffd2b06f749bcb5d0f4cd6e09e460170dcffaa3b8e31ed401e85a468a96064bab8db35fce774d363bfa0f415b3585e19d723d6f4d0e481711e1655f7f5fc6b7690051451400552d4d4be9774aa0b13130000ce78abb50cc6410b9880326d3b41e99ed401c9f87f58bad374c86cf58b2ba8d91079722c4ce197b03b7383501b09fc41e2bb7d43ecb25bd8db60ef9576b4841c8e0f3d71fad5e173e31239b2b0ffbecff00852fda7c61ff003e761ff7d9ff000a606378d21bed66f611696170d1c2a54b95c64e7b56d6997d716be178ade4d3ae7ed10c022d9b7ef103190693ed3e30ff009f3b0ffbecff00851f69f187fcf9d87fdf67fc280399f0bda6a5a1ea62e27d32e5e331943b00c8ae8b5dd6753bab17b5d374bba59251b4cae000a0fa73d6a4fb4f8c3fe7cec3fefb3fe147da7c61ff003e761ff7d9ff000a00d0b9d256efc3274e61f3180019ece0647eb543c11a53e9fa33493465269df710c30401d293ed3e30ff009f3b0ffbecff00851f69f187fcf9d87fdf67fc2901bba95d1b5b376582599d948548c64938af37f0f58ea9a46b51de4da5dc3a00410a0679aeafed3e30ff009f3b0ffbecff00852fda7c63ff003e761ff7d9ff000a6026abaeea4d6cd1e9ba4dd899c63cd75002fd39eb54f50b7ba83c131e951da4d35dcca19caaf00ee0c493577ed3e31ff9f3b0ff00becff851f68f187fcf9d87fdf67fc29019de0a8ef34bf3ed6f2c27413ba957dbc0edcd65eafe1bd4749d7c5ce9303bc5bbcc8ca0fb9fecd749f69f187fcf9d87fdf67fc28fb4f8c3fe7cec3fefb3fe14c0d3b395f50d395ee2dde179170f13f507a1fc2b8f36dab784af273656c6e74f91b784519dbf80e73ffd6adcf3fc5fd7ec761ff7f0ff0085279fe2dff9f2b0ff00bf87fc2b0ab47da59a766ba9bd0aee95d35cd17ba6614faceb7e2089b4fb0d39eda393e591dd4af07af26baed0b498f44d2e3b44f9987ccedfde63d6b384be2c07e5b1d3c7fc0cff00851e678b8e4fd8ec39ff00a687fc2953a1cb2e693bb2ab62bda47d9c23cb1dedddf9b27f14f8686bd6c9244c12ea207613d187a1aafa26a973a6e9c961ab59dd472db8d88e911903a8e9cae7b71527da3c61ff003e761ff7d9ff000a4fb4f8c3fe7cec3fefb3fe15b9cc645fe95a8f8b35b49a5b792d74e886d532f0c477c0eb935a376f22eb3a7db2e9b71fd9b624b6e54c866da4038f419a9bed3e30ff009f3b0ffbecff00851f69f187fcf9d87fdf67fc2981bb7ad17d86432c2f246ebb4a2ae49078c62bcdb42b2d6346d623bb5d3ae1a31f2bae392a6badfb4f8c3fe7cec3fefb3fe149f69f187fcf9d87fdf67fc28032fc6897bacbda4769a7dc32c40b3315c7271c7e95b1e1ff009fc3234fbfb2990c519591197ef024f4a8fed3e30ff9f3b0ff00becff851f69f187fcf9d87fdf67fc2901cae9d67ac687ad9bab1b1b87b70c57695c6f4f4ff003e95e996b3fda6da398c6f19619d8e3047d6b9dfb4f8c3fe7cec3fefb3fe15bf62d74d65135ea225c95fde2a1c807da802dd1451400535812a40383eb4ea43d0d0072fa5deea17f75a844f70145b4db14aa8e4633cf15ab642e95241772238de761518cafbfbd60e896a2e757d6819e64c5c01fbb90aff000fb53f59dda6f873eccb705c24b124ce4f223690673f51915cd4e4d479a5d2fd7cceaab04e5cb1b2bdba7745bbad55d75cb0b78258da0959d64518272149fe95b62e612acde62ed538273d2b9dd4a38535ed0d91541f9d411e9b0d476a13ed1e2107681e6e483fee0a15469bbf7fd2e39518b516b4d3f5b1d3f989b3cc0c36633bb3c62923b88a6526275703ba9cd72367711c763e1d8256c412c60393d0b051b41fd6afdfdb699656da95cc8ccbe7c6a26547e48e8303b139c568aadd5ffadae66e824ecdbbbdb4f3b1bc9710cc58472ab63aed39c556b3d52d6f8ceb6f2ab1898ae73deb02d7cc1e25b005446ad6ae02039f9415c6ef7a9343b74927d691d5594dcc8b823b7a547b4726ade7f916f0ea29b6fa27f8d8deb16963d3e2fb5ce924d8f9e4418526a786e229c663915c772a735c55848dff0008de830b93e44b22ac9e847607d8d6b5fc7f67f12d93db0c35c46e92a8e8ca31827e9934d55bc53b76fc497452934debafa686f35dc09c34ca096da327bfa54d9e38ae056ca25f0f6b8e2240d1dc3ec38fbb80a463f1aecac189b2b762724c6a49fc2aa9d47276688a94d53574efad88df54b54d496c3cd5f3caee2b9e82ad4d730c2409645527a02719ac27894f8de225467ecac7a77dc2934955bf7d605c28793ed0f1b061d107dd1f4c62a54ddede6cb9528d93e964dfcd9d1fde39ed581afdfdd58cd62b6d20513ce2260ca0e01c9c8fcaa6f0b492be8aa2566611cb2c685ba9457217f402aa78abfe3eb49ffafc5fe46aa726e175a134e0954e57adae6f79f1c4312ccbf2ae4962071eb4f13c7e4f9bbd76633bb3c62b9a96ce17f19b86890e6ccb1c8ea77019ac99e256f035eab0056199c460ff00080dc62b3f6cd5f4daff00816a84656d77b7e2772b71148ed1a48acebd403c8a57b8822654791559ba027935ce35bc76be27b016c8a85ede40db463763a6699a4225fe8ba835d00d2bcf2894b75055885fc805ab555bd2da89e1d24a57d34f5d5b5fa1d399e28d951a4504f404f268f3e33214dc37a8c95cf22b8f682e2e3c3763a9382f7566de6ab1eaca1883f9af357a4b8b59b44d4353b86616f3c3b032f04a631c7b9271f850aa7e57f9132a2975beb6f99d0c5710cc488e4572bd70738aa367a9db6a0f731dbc8ac616d9b81e09c7f4ac383cc4f12d86e5588340e360393b7b64fad3f46b7579b5c56552bf6991718ed8a4aa36d25fd697357878c536df44d7df63a1d3bcd4b18fed33a4b28cee914601e4d4b1dcc52ffab915c670769cd71766e53c39a344dc5bc970565f4c6e6c03ed9ad5bf8cc1e27d35e00034eb247328fe2400104fd09fd69aa9a276edf899ba36934df7fc0dd6ba850fcd2a825b6f27bfa55a1d2b816b284681afc9e4a6e8e57d871f7700118fc6bb2b224d8c2c4e498c64fe1442a393b342a949415d3beb6fc117a8a28ad8c429a464119233e94ea2803220d06cada59648bcc4798ee9087fbc7d6a55d1ec8433c2d16f49ff00d60739dd57e93150a9c56c8a7524f76cca4f0ee9c8f0486367780e632ce4eda59b40d3e7b86b878cef7186c3101bea2b568a3d9c6d6b0fdacef7bb323fb134f360ba7f903ecca3e55c9e3dc1a48f42b04b49ad3cadd14df7f73125bd39ad9a3b53e48f60f693fe67bdf7ea63c3e1dd3e19619511fcc886158b9271e86a68f48b48659a68c32b4c497c37193d4d68d18f6149538ad903ab37bb66645a2d945a78b011036c38084f4fa54b0584504a65cb3c9b7687639207a0ad0a4a6a115d04ea49deef731c68564219edb6b79570dbe45ddf78f73fcab4a0856de148933b546067d2a51f5a5a1452d9039c9eeee509f4cb6b8bc8aee453e7440aab038e0f63449a55bbced360a3b8dae50e370f7ad0a28e55d814e4ba90430c76f0ac51205451800761552ff4ab6d41e27b8058c4db939c6d3eb5a340a6e29ab3146528be64f528ff00655b8bf37bf379e53cbdd9fe1f4aaa741b1365259143e448e59973d4f5ad7c518a9e48be8529cd6cca4da55bb5dc574db8cb12ed462dd0534e916ad2c9200ca65ff5814e03fd4569514f963d85cf2ee40208843e508c08f6eddbdb1e9504da6dacf64d66f129b765da53b62ae52d3693dc4a4d6a998d1f8774f865865546f321e118b9271e95347a45a4534f322b2bcfcc986e09f5ad1a31ec2a5538ad914eacdeed9990e8d650e9c2c4459b7072109ce39cf1f8d4d069f1412f9bcbc817607639217d055fa4a6a315b2139c9deef732868767f67b9836b795724995777de27ad5f8205b785624ced518193daa7a28514b6427393d1b168a28aa105145140051451400514514005145140051451400514514005145140051451400514514005145140051451400514514005145140051451400514514005145140051451400514514005145140051451400514514005145140051451400514514005145140051451400514514005145140051451400514514005145140051451400514514005145140051451400514514005145140051451400514514005145140051451400514514005145140051451400514514005145140051451400514514005145140051451400514514005145140051451400514514005145140051451400514514005145140051451400514514005145140051451400514514005145140051451400514514005145140051451400514514005145140051451400514514005145140051451400514514005145140051451400514514005145140051451401ffd9, 0);
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `attandance`
+--
+
+CREATE TABLE `attandance` (
+ `subjectcode` varchar(30) DEFAULT NULL,
+ `date` varchar(30) DEFAULT NULL,
+ `rollnumber` bigint(20) DEFAULT NULL,
+ `present` tinyint(1) NOT NULL DEFAULT 0,
+ `courcecode` varchar(20) DEFAULT NULL,
+ `semoryear` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `chat`
+--
+
+CREATE TABLE `chat` (
+ `sr_no` int(11) NOT NULL,
+ `fromuserid` varchar(70) DEFAULT NULL,
+ `fromusername` varchar(50) DEFAULT NULL,
+ `touserid` varchar(70) DEFAULT NULL,
+ `message` longtext DEFAULT NULL,
+ `messagetime` varchar(20) DEFAULT NULL,
+ `messagedate` varchar(40) DEFAULT NULL,
+ `readby` longtext DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `cources`
+--
+
+CREATE TABLE `cources` (
+ `sr_no` int(11) NOT NULL,
+ `Courcecode` varchar(20) DEFAULT NULL,
+ `CourceName` varchar(30) DEFAULT NULL,
+ `semoryear` varchar(5) DEFAULT NULL,
+ `totalsemoryear` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `faculties`
+--
+
+CREATE TABLE `faculties` (
+ `facultyid` int(11) DEFAULT NULL,
+ `facultyname` varchar(30) DEFAULT NULL,
+ `state` varchar(30) DEFAULT NULL,
+ `city` varchar(30) DEFAULT NULL,
+ `emailid` varchar(50) DEFAULT NULL,
+ `contactnumber` varchar(20) DEFAULT NULL,
+ `qualification` varchar(30) DEFAULT NULL,
+ `experience` varchar(30) DEFAULT NULL,
+ `birthdate` varchar(30) DEFAULT NULL,
+ `gender` varchar(10) DEFAULT NULL,
+ `profilepic` longblob DEFAULT NULL,
+ `courcecode` varchar(20) DEFAULT 'NOT ASSIGNED',
+ `semoryear` int(11) DEFAULT 0,
+ `subject` varchar(40) DEFAULT 'NOT ASSIGNED',
+ `position` varchar(40) DEFAULT 'NOT ASSIGNED',
+ `sr_no` int(11) NOT NULL,
+ `lastlogin` varchar(100) DEFAULT NULL,
+ `password` varchar(30) DEFAULT NULL,
+ `activestatus` tinyint(4) DEFAULT 0,
+ `joineddate` varchar(50) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `marks`
+--
+
+CREATE TABLE `marks` (
+ `courcecode` varchar(20) DEFAULT NULL,
+ `semoryear` int(11) DEFAULT NULL,
+ `subjectcode` varchar(20) DEFAULT NULL,
+ `subjectname` varchar(40) DEFAULT NULL,
+ `rollnumber` bigint(20) DEFAULT NULL,
+ `theorymarks` int(11) DEFAULT NULL,
+ `practicalmarks` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `notification`
+--
+
+CREATE TABLE `notification` (
+ `sr_no` int(11) NOT NULL,
+ `userprofile` varchar(30) DEFAULT NULL,
+ `courcecode` varchar(30) DEFAULT NULL,
+ `semoryear` int(11) DEFAULT NULL,
+ `userid` varchar(30) DEFAULT NULL,
+ `title` varchar(100) DEFAULT NULL,
+ `message` varchar(1000) DEFAULT NULL,
+ `time` varchar(100) DEFAULT NULL,
+ `readby` longtext DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `result`
+--
+
+CREATE TABLE `result` (
+ `courcecode` varchar(30) DEFAULT NULL,
+ `semoryear` int(11) DEFAULT NULL,
+ `isdeclared` tinyint(4) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `rollgenerator`
+--
+
+CREATE TABLE `rollgenerator` (
+ `courcecode` varchar(20) DEFAULT NULL,
+ `semoryear` int(11) DEFAULT NULL,
+ `rollnumber` bigint(20) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `students`
+--
+
+CREATE TABLE `students` (
+ `Courcecode` varchar(20) DEFAULT NULL,
+ `semoryear` int(11) DEFAULT NULL,
+ `rollnumber` bigint(20) DEFAULT NULL,
+ `optionalsubject` varchar(30) DEFAULT NULL,
+ `firstname` varchar(20) DEFAULT NULL,
+ `lastname` varchar(20) DEFAULT NULL,
+ `emailid` varchar(50) DEFAULT NULL,
+ `contactnumber` varchar(20) DEFAULT NULL,
+ `dateofbirth` varchar(15) DEFAULT NULL,
+ `gender` varchar(10) DEFAULT NULL,
+ `state` varchar(30) DEFAULT NULL,
+ `city` varchar(30) DEFAULT NULL,
+ `fathername` varchar(20) DEFAULT NULL,
+ `fatheroccupation` varchar(30) DEFAULT NULL,
+ `mothername` varchar(30) DEFAULT NULL,
+ `motheroccupation` varchar(30) DEFAULT NULL,
+ `profilepic` longblob DEFAULT NULL,
+ `sr_no` int(11) NOT NULL,
+ `lastlogin` varchar(100) DEFAULT NULL,
+ `userid` varchar(50) DEFAULT NULL,
+ `password` varchar(30) DEFAULT NULL,
+ `activestatus` tinyint(4) DEFAULT 0,
+ `admissiondate` varchar(50) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `subject`
+--
+
+CREATE TABLE `subject` (
+ `subjectcode` varchar(20) DEFAULT NULL,
+ `subjectname` varchar(50) DEFAULT NULL,
+ `courcecode` varchar(20) DEFAULT NULL,
+ `semoryear` int(11) DEFAULT NULL,
+ `subjecttype` varchar(30) DEFAULT NULL,
+ `theorymarks` int(11) DEFAULT NULL,
+ `practicalmarks` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- --------------------------------------------------------
+
+--
+-- Table structure for table `users`
+--
+
+CREATE TABLE `users` (
+ `sr_no` int(11) NOT NULL,
+ `courcecode` varchar(30) DEFAULT NULL,
+ `semoryear` int(11) DEFAULT NULL,
+ `userid` mediumtext DEFAULT NULL,
+ `logintime` varchar(100) DEFAULT NULL,
+ `userprofile` varchar(15) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+--
+-- Indexes for dumped tables
+--
+
+--
+-- Indexes for table `chat`
+--
+ALTER TABLE `chat`
+ ADD PRIMARY KEY (`sr_no`);
+
+--
+-- Indexes for table `cources`
+--
+ALTER TABLE `cources`
+ ADD PRIMARY KEY (`sr_no`);
+
+--
+-- Indexes for table `faculties`
+--
+ALTER TABLE `faculties`
+ ADD PRIMARY KEY (`sr_no`);
+
+--
+-- Indexes for table `notification`
+--
+ALTER TABLE `notification`
+ ADD PRIMARY KEY (`sr_no`);
+
+--
+-- Indexes for table `students`
+--
+ALTER TABLE `students`
+ ADD PRIMARY KEY (`sr_no`);
+
+--
+-- Indexes for table `subject`
+--
+ALTER TABLE `subject`
+ ADD UNIQUE KEY `subjectcode` (`subjectcode`);
+
+--
+-- Indexes for table `users`
+--
+ALTER TABLE `users`
+ ADD PRIMARY KEY (`sr_no`);
+
+--
+-- AUTO_INCREMENT for dumped tables
+--
+
+--
+-- AUTO_INCREMENT for table `chat`
+--
+ALTER TABLE `chat`
+ MODIFY `sr_no` int(11) NOT NULL AUTO_INCREMENT;
+
+--
+-- AUTO_INCREMENT for table `cources`
+--
+ALTER TABLE `cources`
+ MODIFY `sr_no` int(11) NOT NULL AUTO_INCREMENT;
+
+--
+-- AUTO_INCREMENT for table `faculties`
+--
+ALTER TABLE `faculties`
+ MODIFY `sr_no` int(11) NOT NULL AUTO_INCREMENT;
+
+--
+-- AUTO_INCREMENT for table `notification`
+--
+ALTER TABLE `notification`
+ MODIFY `sr_no` int(11) NOT NULL AUTO_INCREMENT;
+
+--
+-- AUTO_INCREMENT for table `students`
+--
+ALTER TABLE `students`
+ MODIFY `sr_no` int(11) NOT NULL AUTO_INCREMENT;
+
+--
+-- AUTO_INCREMENT for table `users`
+--
+ALTER TABLE `users`
+ MODIFY `sr_no` int(11) NOT NULL AUTO_INCREMENT;
+COMMIT;
+
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
diff --git a/jar files/mysql-connector-java-5.1.38.jar b/jar files/mysql-connector-java-5.1.38.jar
new file mode 100644
index 0000000..be09493
Binary files /dev/null and b/jar files/mysql-connector-java-5.1.38.jar differ
diff --git a/jar files/rs2xml.jar b/jar files/rs2xml.jar
new file mode 100644
index 0000000..75d9c62
Binary files /dev/null and b/jar files/rs2xml.jar differ
diff --git a/screenshots/attandancereport.png b/screenshots/attandancereport.png
new file mode 100644
index 0000000..0830eda
Binary files /dev/null and b/screenshots/attandancereport.png differ
diff --git a/screenshots/collagedetails.png b/screenshots/collagedetails.png
new file mode 100644
index 0000000..4f44b6f
Binary files /dev/null and b/screenshots/collagedetails.png differ
diff --git a/screenshots/courceslist.png b/screenshots/courceslist.png
new file mode 100644
index 0000000..481c795
Binary files /dev/null and b/screenshots/courceslist.png differ
diff --git a/screenshots/declareresult.png b/screenshots/declareresult.png
new file mode 100644
index 0000000..bdfe3ed
Binary files /dev/null and b/screenshots/declareresult.png differ
diff --git a/screenshots/faculties.png b/screenshots/faculties.png
new file mode 100644
index 0000000..ba3fe4f
Binary files /dev/null and b/screenshots/faculties.png differ
diff --git a/screenshots/groupchatting.png b/screenshots/groupchatting.png
new file mode 100644
index 0000000..7cb63c2
Binary files /dev/null and b/screenshots/groupchatting.png differ
diff --git a/screenshots/homepage.png b/screenshots/homepage.png
new file mode 100644
index 0000000..1ad642d
Binary files /dev/null and b/screenshots/homepage.png differ
diff --git a/screenshots/loginscreen.png b/screenshots/loginscreen.png
new file mode 100644
index 0000000..6bccbdd
Binary files /dev/null and b/screenshots/loginscreen.png differ
diff --git a/screenshots/markattandance.png b/screenshots/markattandance.png
new file mode 100644
index 0000000..5b76e53
Binary files /dev/null and b/screenshots/markattandance.png differ
diff --git a/screenshots/marksheet.png b/screenshots/marksheet.png
new file mode 100644
index 0000000..da1f7fa
Binary files /dev/null and b/screenshots/marksheet.png differ
diff --git a/screenshots/personalchatting.png b/screenshots/personalchatting.png
new file mode 100644
index 0000000..ee02868
Binary files /dev/null and b/screenshots/personalchatting.png differ
diff --git a/screenshots/studentdetails.png b/screenshots/studentdetails.png
new file mode 100644
index 0000000..ca4f024
Binary files /dev/null and b/screenshots/studentdetails.png differ
diff --git a/screenshots/students.png b/screenshots/students.png
new file mode 100644
index 0000000..ed8e105
Binary files /dev/null and b/screenshots/students.png differ
diff --git a/screenshots/subjects.png b/screenshots/subjects.png
new file mode 100644
index 0000000..9255be4
Binary files /dev/null and b/screenshots/subjects.png differ
diff --git a/src/collegeapplication/admin/Admin.java b/src/collegeapplication/admin/Admin.java
new file mode 100644
index 0000000..1e942be
--- /dev/null
+++ b/src/collegeapplication/admin/Admin.java
@@ -0,0 +1,167 @@
+package collegeapplication.admin;
+
+import java.awt.Image;
+import java.awt.Toolkit;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+import javax.imageio.ImageIO;
+
+import collegeapplication.common.ImageUtil;
+
+/*
+ * Title : Admin.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : To bind all data of admin
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+public class Admin
+{
+ private String website;
+ private String contactnumber;
+ private String emailid;
+ private String collagename;
+ private String password;
+ private Image logoimage;
+ private String facebook;
+ private String instagram;
+ private String twitter;
+ private String lastlogin;
+ private String linkedin;
+ private String address;
+ private boolean isactive=false;
+ public void setWebsite(String website)
+ {
+ this.website=website;
+ }
+
+ public void setContactNumber(String contactnumber)
+ {
+ this.contactnumber=contactnumber;
+ }
+ public void setEmailId(String emailid)
+ {
+ this.emailid=emailid;
+ }
+ public void setCollageName(String collagename)
+ {
+ this.collagename=collagename;
+ }
+ public void setPassword(String password)
+ {
+ this.password=password;
+ }
+ public void setProfilePic(byte[] imagedata)
+ {
+ this.logoimage=Toolkit.getDefaultToolkit().createImage(imagedata);
+ }
+ public void setProfilePic(Image profilepic)
+ {
+ this.logoimage=profilepic;
+ }
+ public void setFaceBookLink(String facebooklink)
+ {
+ this.facebook=facebooklink;
+ }
+ public void setInstagramLink(String instagramlink)
+ {
+ this.instagram=instagramlink;
+ }
+ public void setLinkedinLink(String linkedinlink)
+ {
+ this.linkedin=linkedinlink;
+ }
+ public void setTwitterLink(String twitterlink)
+ {
+ this.twitter=twitterlink;
+ }
+ public void setLastLogin(String lastlogin)
+ {
+ this.lastlogin=lastlogin;
+ }
+ public void setActiveStatus(boolean isactive)
+ {
+ this.isactive=isactive;
+ }
+ public void setAddress(String address)
+ {
+ this.address=address;
+ }
+ public String getWebsite()
+ {
+ return website;
+ }
+ public String getContactNumber()
+ {
+ return contactnumber;
+ }
+ public String getEmailId()
+ {
+ return emailid;
+ }
+ public String getCollageName()
+ {
+ return collagename;
+ }
+ public String getPassword()
+ {
+ return password;
+ }
+ public boolean getActiveStatus()
+ {
+ return isactive;
+ }
+ public String getFacebookLink()
+ {
+ return facebook;
+ }
+ public String getInstagramLink()
+ {
+ return instagram;
+ }
+ public String getTwitterLink()
+ {
+ return twitter;
+ }
+ public String getLinkedinLink()
+ {
+ return linkedin;
+ }
+ public Image getProfilePic()
+ {
+ return logoimage;
+ }
+ public byte[] getProfilePicInBytes()
+ {
+ ByteArrayOutputStream imagedata=new ByteArrayOutputStream();
+ try {
+ ImageIO.write(ImageUtil.toBufferedImage(logoimage), "jpg", imagedata);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return imagedata.toByteArray();
+
+ }
+
+ public Image getProfilePic(int width,int height)
+ {
+ return logoimage.getScaledInstance(width, height, Image.SCALE_SMOOTH);
+ }
+ public BufferedImage getRoundedProfilePic(int width,int height,int radius)
+ {
+ return ImageUtil.makeRoundedCorner(ImageUtil.toBufferedImage(logoimage.getScaledInstance(width, height, Image.SCALE_SMOOTH)), radius);
+ }
+ public String getLastLogin()
+ {
+ return lastlogin;
+ }
+ public String getAddress()
+ {
+ return address;
+ }
+
+
+}
diff --git a/src/collegeapplication/admin/AdminData.java b/src/collegeapplication/admin/AdminData.java
new file mode 100644
index 0000000..f370d7d
--- /dev/null
+++ b/src/collegeapplication/admin/AdminData.java
@@ -0,0 +1,183 @@
+package collegeapplication.admin;
+
+import java.awt.Image;
+import java.awt.Toolkit;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.Statement;
+import java.sql.ResultSet;
+import javax.swing.JOptionPane;
+
+import collegeapplication.common.DataBaseConnection;
+import collegeapplication.common.TimeUtil;
+
+/*
+ * Title : AdminData.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : Handling all the data related to admin
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+public class AdminData {
+
+ Connection con=DataBaseConnection.getConnection();
+
+ public int updateAdminLink(Admin a)
+ {
+ int result=0;
+ try
+ {
+ String query="update admin set facebook=?,instagram=?,twitter=?,linkedin=?";
+ PreparedStatement ps=con.prepareStatement(query);
+ ps.setString(1, a.getFacebookLink());
+ ps.setString(2, a.getInstagramLink());
+ ps.setString(3, a.getTwitterLink());
+ ps.setString(4, a.getLinkedinLink());
+ result=ps.executeUpdate();
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+
+ }
+ return result;
+ }
+ public String getLastLogin()
+ {
+ try
+ {
+ String query="select lastlogin from admin";
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ return rs.getString(1);
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return null;
+ }
+ public int updateAdminDetails(Admin a)
+ {
+ int result=0;
+ try
+ {
+ String query="update admin set collagename=?,address=?,emailid=?,contactnumber=?,website=?,lastlogin=?,password=?,logo=?,activestatus=?";
+ PreparedStatement pr=con.prepareStatement(query);
+ pr.setString(1, a.getCollageName());
+ pr.setString(2, a.getAddress());
+ pr.setString(3, a.getEmailId());
+ pr.setString(4, a.getContactNumber());
+ pr.setString(5, a.getWebsite());
+ pr.setString(6, TimeUtil.getCurrentTime());
+ pr.setString(7, a.getPassword());
+ pr.setBytes(8,a.getProfilePicInBytes());
+ pr.setBoolean(9, a.getActiveStatus());
+
+ result=pr.executeUpdate();
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return result;
+ }
+ public boolean isActive()
+ {
+ try
+ {
+ String query="select activestatus from admin";
+ java.sql.Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ return rs.getBoolean(1);
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return false;
+ }
+ public Admin getAdminData()
+ {
+ Admin a=new Admin();
+ try
+ {
+ String query="select * from admin";
+ java.sql.Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ a.setCollageName(rs.getString(1));
+ a.setAddress(rs.getString(2));
+ a.setEmailId(rs.getString(3));
+ a.setContactNumber(rs.getString(4));
+ a.setWebsite(rs.getString(5));
+ a.setLastLogin(rs.getString(6));
+ a.setPassword(rs.getString(7));
+ a.setFaceBookLink(rs.getString(8));
+ a.setInstagramLink(rs.getString(9));
+ a.setTwitterLink(rs.getString(10));
+ a.setLinkedinLink(rs.getString(11));
+ a.setProfilePic(rs.getBytes(12));
+ a.setActiveStatus(rs.getBoolean(13));
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return a;
+ }
+
+ public boolean checkPassword(String userid,String password)
+ {
+ Admin a=this.getAdminData();
+ userid=userid.trim();
+ if(userid.equalsIgnoreCase("Admin")&&a.getPassword().equals(password))
+ {
+ return true;
+ }
+ else
+ {
+ JOptionPane.showMessageDialog(null, "Incorrect Userid or Password","Error",JOptionPane.ERROR_MESSAGE);
+ }
+ return false;
+
+ }
+ public int setActiveStatus(boolean status)
+ {
+ int result=0;
+ try
+ {
+ String query="update admin set activestatus="+status;
+ PreparedStatement pr=con.prepareStatement(query);
+ result=pr.executeUpdate();
+ pr.close();
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return result;
+
+ }
+ public Image getProfilePic()
+ {
+ try
+ {
+ String query="select logo from admin";
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ byte[] imagedata=rs.getBytes(1);
+ Image image=Toolkit.getDefaultToolkit().createImage(imagedata);
+ return image;
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return null;
+ }
+}
+
+
diff --git a/src/collegeapplication/admin/AdminMain.java b/src/collegeapplication/admin/AdminMain.java
new file mode 100644
index 0000000..da9921f
--- /dev/null
+++ b/src/collegeapplication/admin/AdminMain.java
@@ -0,0 +1,679 @@
+package collegeapplication.admin;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.EventQueue;
+import java.awt.Font;
+import java.awt.Image;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.File;
+import java.io.IOException;
+
+import javax.imageio.ImageIO;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.SwingConstants;
+import javax.swing.Timer;
+import javax.swing.UIManager;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.LineBorder;
+import javax.swing.border.MatteBorder;
+import javax.swing.plaf.ColorUIResource;
+
+import collegeapplication.chat.ChatData;
+import collegeapplication.chat.ChatMainPanel;
+import collegeapplication.common.DataBaseConnection;
+import collegeapplication.common.HomePanel;
+import collegeapplication.common.SearchPanel;
+import collegeapplication.common.TimeUtil;
+import collegeapplication.common.UsersPanel;
+import collegeapplication.cource.CourcePanel;
+import collegeapplication.faculty.FacultyPanel;
+import collegeapplication.faculty.ViewFacultyPanel;
+import collegeapplication.login.LoginPageFrame;
+import collegeapplication.student.AttandanceReportPanel;
+import collegeapplication.student.EnterMarksPanel;
+import collegeapplication.student.MarkAttandancePanel;
+import collegeapplication.student.MarkSheetPanel;
+import collegeapplication.student.MarkSheetReportPanel;
+import collegeapplication.student.StudentPanel;
+import collegeapplication.student.ViewStudentPanel;
+import collegeapplication.subject.AssignSubjectPanel;
+import collegeapplication.subject.SubjectPanel;
+
+/*
+ * Title : AdminMain.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : Main admin frame
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+@SuppressWarnings("serial")
+public class AdminMain extends JFrame implements ActionListener
+{
+
+
+ public JPanel contentPane;
+ private JLabel collagenamelabel;
+ private JLabel profilepiclabel;
+ private JPanel profilepanel;
+ private JButton homebutton;
+ private JButton courcebutton;
+ private JButton studentsbutton;
+ private JButton subjectbutton;
+ private JButton faculitiesbutton;
+ private JButton usersbutton;
+ private JButton entermarksbutton;
+ private JButton assignsubjectbutton;
+ private JButton markattandancebutton;
+ private JButton attandancereportbutton;
+ private JButton searchbutton;
+ private JButton exitbutton;
+ private JButton btn;
+ private JButton adminprofilebutton;
+
+ private Color buttonbcolor=Color.DARK_GRAY;
+ private Color buttonfcolor=Color.LIGHT_GRAY;
+ private Font buttonfont=new Font("Tw Cen MT", Font.PLAIN, 20);
+ private CourcePanel courcepanel;
+ private SubjectPanel subjectpanel;
+ private HomePanel homepanel;
+
+ public StudentPanel studentpanel;
+ public ViewStudentPanel viewstudentpanel;
+ public MarkSheetPanel marksheetpanel;
+ public JScrollPane marksheetpanelscroll;
+ public ViewFacultyPanel viewfacultypanel;
+ public AssignSubjectPanel assignsubjectpanel;
+ public EnterMarksPanel entermarkspanel;
+ public JScrollPane entermarkspanelscroll;
+ private MarkAttandancePanel markattandancepanel;
+ private JScrollPane markattandancepanelscroll;
+ public AttandanceReportPanel attandancereportpanel;
+ public JScrollPane attandancereportpanelscroll;
+ public MarkSheetReportPanel marksheetreportpanel;
+ public JScrollPane marksheetreportpanelscroll;
+ public FacultyPanel facultypanel;
+ public AdminProfilePanel adminprofilepanel;
+ public SearchPanel searchpanel;
+ public ChatMainPanel chatmainpanel;
+ public UsersPanel userspanel;
+
+ public int panely=0,panelx=250;
+
+ private Admin a;
+ private String lastlogin;
+ private JButton chatbutton;
+ private int row=0;
+ private JButton logoutbutton;
+ private Timer timer;
+ private JButton marksheetreportbutton;
+ private JLabel totalnewchatmessage;
+ private Image messagecount;
+ private int chat;
+ /**
+ * Launch the application.
+ */
+ public static void main(String[] args) {
+ EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ try {
+
+ if(DataBaseConnection.checkconnection())
+ {
+ AdminMain frame = new AdminMain();
+ frame.setVisible(true);
+ }
+ else
+ {
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ JOptionPane.showMessageDialog(null, "You Are Not Connected To DataBase","Error",JOptionPane.ERROR_MESSAGE);
+ }
+ new Thread().start();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ }
+
+ /**
+ * Create the frame.
+ */
+ public AdminMain() {
+
+
+ a=new AdminData().getAdminData();
+ ActionListener setActive=new ActionListener()
+ {
+ public void actionPerformed(ActionEvent arg0)
+ {
+ int result=new AdminData().setActiveStatus(a.getActiveStatus());
+
+ if(result>0)
+ {
+ chat=new ChatData().getUndreadMessageCountAdmin();
+ if(chat>0)
+ {
+ totalnewchatmessage.setText(chat>999?"999+":chat+"");
+ totalnewchatmessage.setVisible(true);
+ totalnewchatmessage.setIcon(new ImageIcon(messagecount.getScaledInstance(26+totalnewchatmessage.getText().length(), 26, Image.SCALE_SMOOTH)));
+ }
+ else
+ {
+ totalnewchatmessage.setVisible(false);
+ }
+ }
+
+ }
+
+ };
+ timer=new Timer(2000,setActive);
+ timer.start();
+
+ Color bgColor =new Color(32,178,170);
+ Color frColor=Color.white;
+
+ UIManager.put("ComboBoxUI", "com.sun.java.swing.plaf.windows.WindowsComboBoxUI");
+ UIManager.put("ComboBox.selectionBackground", new ColorUIResource(bgColor));
+ UIManager.put("ComboBox.background", new ColorUIResource(Color.white));
+ UIManager.put("ComboBox.foreground", new ColorUIResource(Color.DARK_GRAY));
+ UIManager.put("ComboBox.selectionForeground", new ColorUIResource(frColor));
+ UIManager.put("ScrollBarUI", "com.sun.java.swing.plaf.windows.WindowsScrollBarUI");
+
+ try
+ {
+ messagecount=ImageIO.read(new File("./assets/messagecount.png"));
+ }
+ catch(IOException exp)
+ {
+ exp.printStackTrace();
+ }
+ this.setResizable(false);
+ setTitle("Collage Data Management");
+ setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
+ contentPane = new JPanel();
+ contentPane.setForeground(Color.DARK_GRAY);
+ contentPane.setBackground(Color.DARK_GRAY);
+ contentPane.setBorder(new EmptyBorder(0, 0, 0, 0));
+ setContentPane(contentPane);
+ contentPane.setLayout(null);
+
+ this.setBounds(-2,0,1370,733);
+
+ profilepanel = new JPanel();
+ profilepanel.setBounds(5, 7, 240, 63);
+ contentPane.add(profilepanel);
+ profilepanel.setBorder(new MatteBorder(0, 0, 2, 0, (Color) Color.LIGHT_GRAY));
+ profilepanel.setBackground(Color.DARK_GRAY);
+ profilepanel.setLayout(null);
+
+ collagenamelabel = new JLabel();
+ collagenamelabel.setForeground(Color.WHITE);
+ collagenamelabel.setHorizontalAlignment(SwingConstants.LEFT);
+ collagenamelabel.setFont(new Font("Tw Cen MT", Font.BOLD, 25));
+ collagenamelabel.setBackground(Color.DARK_GRAY);
+ collagenamelabel.setText("Adminstrator");
+ collagenamelabel.setOpaque(true);
+ collagenamelabel.setBounds(65, 5, 171, 36);
+ profilepanel.add(collagenamelabel);
+
+ profilepiclabel = new JLabel();
+ profilepiclabel.setBounds(5, 0, 50, 50);
+ profilepanel.add(profilepiclabel);
+ profilepiclabel.setHorizontalAlignment(SwingConstants.CENTER);
+ profilepiclabel.setBackground(Color.DARK_GRAY);
+ profilepiclabel.setBorder(new LineBorder(Color.black, 0));
+ profilepiclabel.setOpaque(true);
+
+ createHomepanel();
+
+
+ //creating side bar panel
+ JPanel sidebarpanel = new JPanel();
+ sidebarpanel.setBorder(new MatteBorder(0, 0, 0, 2, (Color) new Color(64, 64, 64)));
+ sidebarpanel.setBackground(Color.DARK_GRAY);
+ sidebarpanel.setBounds(5, 75, 240, 654);
+ contentPane.add(sidebarpanel);
+ sidebarpanel.setLayout(null);
+
+ //Adding buttons to sidebar
+ homebutton =createButton("Home");
+ sidebarpanel.add(homebutton);
+ btn=homebutton;
+
+ courcebutton = createButton("Cources");
+ sidebarpanel.add(courcebutton);
+
+ studentsbutton =createButton("Students");
+ sidebarpanel.add(studentsbutton);
+
+ subjectbutton = createButton("Subjects");
+ sidebarpanel.add(subjectbutton);
+
+ faculitiesbutton = createButton("Faculities");
+ sidebarpanel.add(faculitiesbutton);
+
+ assignsubjectbutton = createButton("Assign Subject");
+ sidebarpanel.add(assignsubjectbutton);
+
+ entermarksbutton = createButton("Enter Marks");
+ sidebarpanel.add(entermarksbutton);
+
+ marksheetreportbutton = createButton("Marksheet Report");
+ sidebarpanel.add(marksheetreportbutton);
+
+ markattandancebutton = createButton("Mark Attandance");
+ sidebarpanel.add(markattandancebutton);
+
+ attandancereportbutton =createButton("Attandance Report");
+ sidebarpanel.add(attandancereportbutton);
+
+ chatbutton = createButton("Chat");
+ chatbutton.setLayout(new BorderLayout());
+ sidebarpanel.add(chatbutton);
+ chat=new ChatData().getUndreadMessageCountAdmin();
+ totalnewchatmessage=new JLabel();
+ totalnewchatmessage.setSize(60,30);
+ totalnewchatmessage.setFont(new Font("Arial",Font.BOLD,12));
+ totalnewchatmessage.setForeground(Color.white);
+ totalnewchatmessage.setHorizontalTextPosition(JLabel.CENTER);
+ totalnewchatmessage.setVerticalTextPosition(JLabel.CENTER);
+ chatbutton.add(totalnewchatmessage,BorderLayout.LINE_END);
+ if(chat>0)
+ {
+ totalnewchatmessage.setText(chat>999?"999+":chat+"");
+ totalnewchatmessage.setVisible(true);
+ totalnewchatmessage.setIcon(new ImageIcon(messagecount.getScaledInstance(26+totalnewchatmessage.getText().length(), 26, Image.SCALE_SMOOTH)));
+ }
+// ActionListener refreshchat=e->
+// {
+//
+// };
+// Timer activechattimer=new Timer(2000,refreshchat);
+// activechattimer.start();
+//
+ searchbutton = createButton("Search");
+ sidebarpanel.add(searchbutton);
+
+ usersbutton = createButton("Users");
+ sidebarpanel.add(usersbutton);
+
+ adminprofilebutton = createButton("Admin Profile","Profile");
+ sidebarpanel.add(adminprofilebutton);
+
+ logoutbutton = createButton("Logout");
+ sidebarpanel.add(logoutbutton);
+
+ exitbutton = createButton("Exit");
+ sidebarpanel.add(exitbutton);
+
+ activeButton(homebutton);
+ homepanel.setVisible(true);
+
+ this.setCollageDetails();
+ lastlogin=a.getLastLogin();
+ homepanel.setLastLogin(lastlogin);
+ a.setLastLogin(TimeUtil.getCurrentTime());
+ a.setActiveStatus(true);
+ new AdminData().updateAdminDetails(a);
+
+
+ this.addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowClosing(final WindowEvent windowenent) {
+ openPanel(exitbutton);
+
+ }
+ });
+
+
+
+ }
+ public void createHomepanel()
+ {
+ homepanel=new HomePanel(a);
+ homepanel.setLocation(panelx,panely);
+ homepanel.setFocusable(true);
+ contentPane.add(homepanel);
+ }
+
+ public void activeButton(JButton button)
+ {
+ btn.setBackground(buttonbcolor);
+ btn.setForeground(buttonfcolor);
+ btn.setFont(buttonfont);
+ btn.setDisabledIcon(new ImageIcon(""));
+ btn.setIcon(new ImageIcon("./assets/"+btn.getName()+"dac.png"));
+ btn=button;
+ btn.setForeground(Color.white);
+ btn.setFont(new Font("Tw Cen MT", Font.BOLD, 23));
+ btn.setIcon(new ImageIcon("./assets/"+btn.getName()+"ac.png"));
+ disablepanel();
+ }
+
+ public JButton createButton(String text,String name)
+ {
+ JButton button=createButton(text);
+ button.setName(name);
+ button.setIcon(new ImageIcon("./assets/"+button.getName()+"dac.png"));
+ return button;
+ }
+ public JButton createButton(String text)
+ {
+ JButton button=new JButton();
+ button.setForeground(buttonfcolor);
+ button.setFont(buttonfont);
+ button.setBackground(buttonbcolor);
+ button.setHorizontalAlignment(SwingConstants.LEFT);
+ button.setFocusable(false);
+ button.setContentAreaFilled(false);
+ button.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ button.setBorder(new EmptyBorder(0,0,0,0));
+ button.setText(text);
+ button.setName(text);
+ button.setIcon(new ImageIcon("./assets/"+button.getName()+"dac.png"));
+ button.addActionListener(this);
+ button.setIconTextGap(10);
+ button.setLocation(0, row);
+ button.setSize(234, 40);
+ row+=39;
+ return button;
+ }
+
+ public void disablepanel()
+ {
+ if(homepanel!=null && homepanel.isVisible())
+ {
+ homepanel.setVisible(false);
+ }
+ else if(courcepanel!=null&&courcepanel.isVisible())
+ {
+ courcepanel.setVisible(false);
+ }
+ else if(subjectpanel!=null&&subjectpanel.isVisible())
+ {
+ subjectpanel.setVisible(false);
+ }
+ else if(studentpanel!=null&&studentpanel.isVisible())
+ {
+ studentpanel.setVisible(false);
+ }
+ else if(viewstudentpanel!=null && viewstudentpanel.isVisible())
+ {
+
+ viewstudentpanel.setVisible(false);
+ }
+ else if(facultypanel!=null && facultypanel.isVisible())
+ {
+ facultypanel.setVisible(false);
+ }
+ else if(viewfacultypanel!=null&&viewfacultypanel.isVisible())
+ {
+ viewfacultypanel.setVisible(false);
+ }
+ else if(assignsubjectpanel!=null &&assignsubjectpanel.isVisible())
+ {
+ assignsubjectpanel.setVisible(false);
+ }
+ else if(entermarkspanelscroll!=null && entermarkspanelscroll.isVisible())
+ {
+ entermarkspanelscroll.setVisible(false);
+ }
+ else if(marksheetpanelscroll!=null&& marksheetpanelscroll.isVisible())
+ {
+ marksheetpanelscroll.setVisible(false);
+ }
+ else if(markattandancepanelscroll!=null && markattandancepanelscroll.isVisible())
+ {
+ markattandancepanelscroll.setVisible(false);
+ }
+ else if(attandancereportpanelscroll!=null && attandancereportpanelscroll.isVisible())
+ {
+ attandancereportpanelscroll.setVisible(false);
+ }
+ else if(marksheetreportpanelscroll!=null && marksheetreportpanelscroll.isVisible())
+ {
+ marksheetreportpanelscroll.setVisible(false);
+ }
+ else if(adminprofilepanel!=null && adminprofilepanel.isVisible())
+ {
+ adminprofilepanel.setVisible(false);
+ }
+ else if(searchpanel!=null && searchpanel.isVisible())
+ {
+ searchpanel.setVisible(false);
+ }
+ else if(chatmainpanel!=null && chatmainpanel.isVisible())
+ {
+
+ try {
+
+ if(chatmainpanel.chatpanel.subchatpanel!=null&&chatmainpanel.chatpanel.subchatpanel.socket!=null&&!chatmainpanel.chatpanel.subchatpanel.socket.isClosed())
+ {
+ chatmainpanel.chatpanel.subchatpanel.socket.close();
+ }
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ chatmainpanel.setVisible(false);
+ }
+ else if(userspanel!=null && userspanel.isVisible())
+ {
+ userspanel.setVisible(false);
+ }
+
+ }
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ openPanel(e.getSource());
+ }
+ public void openPanel(Object source)
+ {
+ if(source==homebutton)
+ {
+ activeButton(homebutton);
+ homepanel=new HomePanel(a);
+ homepanel.setLocation(panelx, panely);
+ homepanel.setFocusable(true);
+ contentPane.add(homepanel);
+ homepanel.setVisible(true);
+ homepanel.setLastLogin(lastlogin);
+ }
+ else if(source==courcebutton)
+ {
+ activeButton(courcebutton);
+ courcepanel=new CourcePanel();
+ courcepanel.setLocation(panelx,panely);
+ courcepanel.setFocusable(true);
+ contentPane.add(courcepanel);
+ courcepanel.setVisible(true);
+ }
+ else if(source==subjectbutton)
+ {
+ activeButton(subjectbutton);
+ subjectpanel=new SubjectPanel(this);
+ subjectpanel.setLocation(panelx, panely);
+ subjectpanel.setFocusable(true);
+ contentPane.add(subjectpanel);
+ subjectpanel.setVisible(true);
+ }
+ else if(source==studentsbutton)
+ {
+ activeButton(studentsbutton);
+ studentpanel = new StudentPanel(this);
+ studentpanel.setLocation(panelx, panely);
+ studentpanel.setVisible(true);
+ studentpanel.setFocusable(true);
+ contentPane.add(studentpanel);
+
+ }
+ else if(source==faculitiesbutton)
+ {
+ activeButton(faculitiesbutton);
+ facultypanel=new FacultyPanel(this);
+ facultypanel.setLocation(panelx,panely);
+ facultypanel.setVisible(true);
+ facultypanel.setFocusable(true);
+ contentPane.add(facultypanel);
+
+ }
+ else if(source==assignsubjectbutton)
+ {
+ activeButton(assignsubjectbutton);
+ assignsubjectpanel=new AssignSubjectPanel(this);
+ assignsubjectpanel.setLocation(panelx,panely);
+ assignsubjectpanel.setVisible(true);
+ assignsubjectpanel.setFocusable(true);
+ contentPane.add(assignsubjectpanel);
+
+ }
+ else if(source==entermarksbutton)
+ {
+ activeButton(entermarksbutton);
+ entermarkspanel=new EnterMarksPanel();
+ entermarkspanel.setVisible(true);
+ entermarkspanelscroll=new JScrollPane(entermarkspanel,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ entermarkspanelscroll.setBounds(panelx,panely,1116,705);
+ entermarkspanelscroll.setVisible(true);
+ entermarkspanelscroll.getVerticalScrollBar().setUnitIncrement(80);
+ contentPane.add(entermarkspanelscroll);
+ for(Component c:entermarkspanelscroll.getComponents())
+ {
+ c.setBackground(Color.white);
+ }
+
+ }
+ else if(source==markattandancebutton)
+ {
+ activeButton(markattandancebutton);
+ markattandancepanel=new MarkAttandancePanel(this);
+ markattandancepanel.setVisible(true);
+ markattandancepanelscroll=new JScrollPane(markattandancepanel,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ markattandancepanelscroll.setBounds(panelx, panely, 1116, 705);
+ markattandancepanelscroll.setVisible(true);
+ markattandancepanelscroll.getVerticalScrollBar().setUnitIncrement(80);
+ contentPane.add(markattandancepanelscroll);
+ for(Component c:markattandancepanelscroll.getComponents())
+ {
+ c.setBackground(Color.white);
+ }
+ }
+ else if(source==attandancereportbutton)
+ {
+ activeButton(attandancereportbutton);
+ attandancereportpanel=new AttandanceReportPanel(this);
+ attandancereportpanel.setVisible(true);
+ attandancereportpanelscroll=new JScrollPane(attandancereportpanel,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ attandancereportpanelscroll.setBounds(panelx, panely, 1116, 705);
+ attandancereportpanelscroll.setVisible(true);
+ attandancereportpanelscroll.setName("Attadance Report Panel Scroll");
+ attandancereportpanelscroll.getVerticalScrollBar().setUnitIncrement(80);
+ contentPane.add(attandancereportpanelscroll);
+ for(Component c:attandancereportpanelscroll.getComponents())
+ {
+ c.setBackground(Color.white);
+ }
+ }
+ else if(source==marksheetreportbutton)
+ {
+ activeButton(marksheetreportbutton);
+ marksheetreportpanel=new MarkSheetReportPanel(this);
+ marksheetreportpanel.setVisible(true);
+ marksheetreportpanelscroll=new JScrollPane(marksheetreportpanel,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ marksheetreportpanelscroll.setBounds(panelx, panely, 1116, 705);
+ marksheetreportpanelscroll.setVisible(true);
+ marksheetreportpanelscroll.setName("Marksheet Report Panel Scroll");
+ marksheetreportpanelscroll.getVerticalScrollBar().setUnitIncrement(80);
+ contentPane.add(marksheetreportpanelscroll);
+ for(Component c:marksheetreportpanelscroll.getComponents())
+ {
+ c.setBackground(Color.white);
+ }
+ }
+ else if(source==usersbutton)
+ {
+ activeButton(usersbutton);
+ userspanel=new UsersPanel(this);
+ userspanel.setVisible(true);
+ userspanel.setLocation(this.panelx, this.panely);
+ contentPane.add(userspanel);
+ }
+ else if(source==chatbutton)
+ {
+
+ activeButton(chatbutton);
+ chatmainpanel=new ChatMainPanel(this);
+ chatmainpanel.setLocation(this.panelx, this.panely);
+ chatmainpanel.setVisible(true);
+ contentPane.add(chatmainpanel);
+
+ }
+ else if(source==searchbutton)
+ {
+ activeButton(searchbutton);
+ searchpanel=new SearchPanel(this);
+ searchpanel.setLocation(this.panelx, this.panely);
+ searchpanel.setVisible(true);
+ contentPane.add(searchpanel);
+
+ }
+ else if(source==adminprofilebutton)
+ {
+ activeButton(adminprofilebutton);
+ adminprofilepanel=new AdminProfilePanel(this);
+ adminprofilepanel.setLocation(panelx,panely);
+ adminprofilepanel.setVisible(true);
+ adminprofilepanel.setFocusable(true);
+ contentPane.add(adminprofilepanel);
+ }
+ else if(source==exitbutton)
+ {
+ int result=JOptionPane.showConfirmDialog(null,"Do you want to exit this application ?","Exit",JOptionPane.INFORMATION_MESSAGE);
+ if(result==JOptionPane.YES_OPTION)
+ {
+ a.setActiveStatus(false);
+ timer.stop();
+ new AdminData().setActiveStatus(false);
+ this.disablepanel();
+ DataBaseConnection.closeConnection();
+ System.exit(0);
+ }
+ }
+ else if(source==logoutbutton)
+ {
+ int result=JOptionPane.showConfirmDialog(null,"Do you want to logout this application ?","Logout",JOptionPane.INFORMATION_MESSAGE);
+ if(result==JOptionPane.YES_OPTION)
+ {
+ a.setActiveStatus(false);
+ timer.stop();
+ new AdminData().setActiveStatus(false);
+ LoginPageFrame loginpageframe=new LoginPageFrame();
+ loginpageframe.setVisible(true);
+ loginpageframe.setLocationRelativeTo(null);
+ this.disablepanel();
+ this.dispose();
+ }
+ }
+
+ }
+
+
+
+ public void setCollageDetails()
+ {
+ a=new AdminData().getAdminData();
+ profilepiclabel.setIcon(new ImageIcon(a.getRoundedProfilePic(50, 50, 50)));
+ }
+}
diff --git a/src/collegeapplication/admin/AdminProfilePanel.java b/src/collegeapplication/admin/AdminProfilePanel.java
new file mode 100644
index 0000000..e63450b
--- /dev/null
+++ b/src/collegeapplication/admin/AdminProfilePanel.java
@@ -0,0 +1,324 @@
+package collegeapplication.admin;
+
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Desktop;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.io.IOException;
+import java.net.URI;
+
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.SwingConstants;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.LineBorder;
+
+/*
+ * Title : AdminProfilePanel.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : All the data related to admin displaying using this panel
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+@SuppressWarnings("serial")
+public class AdminProfilePanel extends JPanel {
+
+ private JPanel panel;
+ private Admin a;
+ private JLabel headinglabel;
+
+ /**
+ * Create the panel.
+ */
+
+
+ public AdminProfilePanel(AdminMain am)
+ {
+ this();
+ headinglabel.setText("Admin Profile");
+ JButton editdetailsbutton = new JButton("Edit Details");
+ editdetailsbutton.setFocusPainted(false);
+ editdetailsbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ editdetailsbutton.setForeground(new Color(0, 139, 139));
+ editdetailsbutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ editdetailsbutton.setBackground(new Color(255, 255, 255));
+ editdetailsbutton.setBounds(925, 139, 161, 33);
+ editdetailsbutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ editdetailsbutton.addActionListener(e->
+ {
+ EditAdminDetailsDialog caad=new EditAdminDetailsDialog(a,am);
+ caad.setLocationRelativeTo(null);
+ caad.setVisible(true);
+ });
+ panel.add(editdetailsbutton);
+
+
+ JButton editlinksbutton = new JButton("Edit Links");
+ editlinksbutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ editlinksbutton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ EditAdminLinksDialog ed=new EditAdminLinksDialog(a,am);
+ ed.setLocationRelativeTo(null);
+ ed.setVisible(true);
+ }
+ });
+ editlinksbutton.setForeground(new Color(0, 139, 139));
+ editlinksbutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ editlinksbutton.setFocusPainted(false);
+ editlinksbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ editlinksbutton.setBackground(Color.WHITE);
+ editlinksbutton.setBounds(754, 139, 161, 33);
+ panel.add(editlinksbutton);
+ }
+ public AdminProfilePanel() {
+
+ a=new AdminData().getAdminData();
+ setBackground(new Color(255, 255, 255));
+ this.setSize(1116, 705);
+ setLayout(null);
+ panel = new JPanel();
+ panel.setBackground(new Color(32, 178, 170));
+ panel.setBounds(10, 0, 1096, 183);
+ add(panel);
+ panel.setLayout(null);
+ headinglabel = new JLabel("Contact Us");
+ headinglabel.setIcon(null);
+ headinglabel.setBounds(10, 65, 272, 44);
+ panel.add(headinglabel);
+ headinglabel.setBackground(new Color(32, 178, 170));
+ headinglabel.setHorizontalAlignment(SwingConstants.LEFT);
+ headinglabel.setForeground(Color.WHITE);
+ headinglabel.setFont(new Font("Segoe UI", Font.BOLD, 30));
+ headinglabel.setOpaque(true);
+
+
+
+ JLabel collagelogolabel = new JLabel();
+ collagelogolabel.setHorizontalAlignment(SwingConstants.CENTER);
+ collagelogolabel.setHorizontalTextPosition(SwingConstants.CENTER);
+ collagelogolabel.setIcon(new ImageIcon(a.getProfilePic(200, 180)));
+ collagelogolabel.setBorder(new LineBorder(new Color(0, 0, 0)));
+ collagelogolabel.setBounds(24, 213, 200, 180);
+ add(collagelogolabel);
+
+ JLabel lblCollageName = new JLabel("Collage Name : ");
+ lblCollageName.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblCollageName.setFont(new Font("Segoe UI", Font.PLAIN, 20));
+ lblCollageName.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ lblCollageName.setBounds(233, 213, 191, 48);
+ add(lblCollageName);
+
+ JLabel collagenamelable = new JLabel(" "+a.getCollageName());
+ collagenamelable.setToolTipText(a.getCollageName());
+ collagenamelable.setHorizontalAlignment(SwingConstants.LEFT);
+ collagenamelable.setFont(new Font("Segoe UI Semibold", Font.BOLD, 20));
+ collagenamelable.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ collagenamelable.setBounds(423, 213, 672, 48);
+ add(collagenamelable);
+
+ JLabel lblEmailId = new JLabel("Email ID : ");
+ lblEmailId.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblEmailId.setFont(new Font("Segoe UI", Font.PLAIN, 20));
+ lblEmailId.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ lblEmailId.setBounds(233, 260, 191, 48);
+ add(lblEmailId);
+
+ JLabel emailidlabel = new JLabel(" "+a.getEmailId());
+ emailidlabel.setToolTipText(a.getEmailId());
+ emailidlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ emailidlabel.setFont(new Font("Segoe UI Semibold", Font.BOLD, 20));
+ emailidlabel.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ emailidlabel.setBounds(423, 260, 672, 48);
+ add(emailidlabel);
+
+ JLabel lblContactNumber = new JLabel("Contact Number : ");
+ lblContactNumber.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblContactNumber.setFont(new Font("Segoe UI", Font.PLAIN, 20));
+ lblContactNumber.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ lblContactNumber.setBounds(233, 307, 191, 48);
+ add(lblContactNumber);
+
+ JLabel contactnumberlabel = new JLabel(" "+a.getContactNumber());
+ contactnumberlabel.setToolTipText(a.getContactNumber());
+ contactnumberlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ contactnumberlabel.setFont(new Font("Segoe UI Semibold", Font.BOLD, 20));
+ contactnumberlabel.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ contactnumberlabel.setBounds(423, 307, 672, 48);
+ add(contactnumberlabel);
+
+ JLabel lblWebsite = new JLabel("Website : ");
+ lblWebsite.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblWebsite.setFont(new Font("Segoe UI", Font.PLAIN, 20));
+ lblWebsite.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ lblWebsite.setBounds(233, 354, 191, 48);
+ add(lblWebsite);
+
+ JLabel websitelabel = new JLabel("  "+a.getWebsite()+"");
+ websitelabel.setToolTipText(a.getWebsite());
+ websitelabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+ websitelabel.setForeground(new Color(65, 105, 225));
+ websitelabel.setHorizontalAlignment(SwingConstants.LEFT);
+ websitelabel.setFont(new Font("Segoe UI", Font.PLAIN, 20));
+ websitelabel.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ websitelabel.addMouseListener(new MouseAdapter()
+ {
+ public void mouseClicked(MouseEvent e)
+ {
+ websitelabel.setCursor(new Cursor(Cursor.WAIT_CURSOR));
+ openLink(a.getWebsite());
+ websitelabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ }
+ }
+ );
+ websitelabel.setBounds(423, 354, 672, 48);
+ add(websitelabel);
+
+ JLabel lblAddress = new JLabel("Address : ");
+ lblAddress.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblAddress.setFont(new Font("Segoe UI", Font.PLAIN, 20));
+ lblAddress.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ lblAddress.setBounds(23, 401, 211, 48);
+ add(lblAddress);
+
+ JLabel addresslabel = new JLabel(" "+a.getAddress());
+ addresslabel.setToolTipText(a.getAddress());
+ addresslabel.setHorizontalAlignment(SwingConstants.LEFT);
+ addresslabel.setForeground(Color.BLACK);
+ addresslabel.setFont(new Font("Segoe UI Semibold", Font.BOLD, 20));
+ addresslabel.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ addresslabel.setBounds(233, 401, 862, 48);
+ add(addresslabel);
+
+ JLabel lblFaceBook = new JLabel("Face Book : ");
+
+ lblFaceBook.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblFaceBook.setFont(new Font("Segoe UI", Font.PLAIN, 20));
+ lblFaceBook.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ lblFaceBook.setBounds(24, 460, 211, 48);
+ add(lblFaceBook);
+
+ JLabel facebooklabel = new JLabel("  "+a.getFacebookLink()+"");
+ facebooklabel.setToolTipText(a.getFacebookLink());
+ facebooklabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+ facebooklabel.setHorizontalAlignment(SwingConstants.LEFT);
+ facebooklabel.addMouseListener(new MouseAdapter()
+ {
+ public void mouseClicked(MouseEvent e)
+ {
+ facebooklabel.setCursor(new Cursor(Cursor.WAIT_CURSOR));
+ openLink(a.getFacebookLink());
+ facebooklabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ }
+ }
+ );
+
+ facebooklabel.setForeground(new Color(65, 105, 225));
+ facebooklabel.setFont(new Font("Segoe UI", Font.PLAIN, 20));
+ facebooklabel.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ facebooklabel.setBounds(234, 460, 862, 48);
+ add(facebooklabel);
+
+ JLabel lblTwitter = new JLabel("Instagram : ");
+ lblTwitter.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblTwitter.setFont(new Font("Segoe UI", Font.PLAIN, 20));
+ lblTwitter.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ lblTwitter.setBounds(24, 507, 211, 48);
+ add(lblTwitter);
+
+ JLabel instagramlabel = new JLabel("  "+a.getInstagramLink()+"");
+ instagramlabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+ instagramlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ instagramlabel.setForeground(new Color(65, 105, 225));
+ instagramlabel.setFont(new Font("Segoe UI", Font.PLAIN, 20));
+ instagramlabel.setToolTipText(a.getInstagramLink());
+ instagramlabel.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ instagramlabel.setBounds(234, 507, 862, 48);
+ instagramlabel.addMouseListener(new MouseAdapter()
+ {
+ public void mouseClicked(MouseEvent e)
+ {
+ instagramlabel.setCursor(new Cursor(Cursor.WAIT_CURSOR));
+ openLink(a.getInstagramLink());
+ instagramlabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ }
+ }
+ );
+ add(instagramlabel);
+
+ JLabel label_1 = new JLabel("Twitter : ");
+ label_1.setHorizontalAlignment(SwingConstants.RIGHT);
+ label_1.setFont(new Font("Segoe UI", Font.PLAIN, 20));
+ label_1.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ label_1.setBounds(24, 554, 211, 48);
+ add(label_1);
+
+ JLabel twitterlabel = new JLabel("  "+a.getTwitterLink()+"");
+ twitterlabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+ twitterlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ twitterlabel.setForeground(new Color(65, 105, 225));
+ twitterlabel.setToolTipText(a.getTwitterLink());
+ twitterlabel.setFont(new Font("Segoe UI", Font.PLAIN, 20));
+ twitterlabel.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ twitterlabel.setBounds(234, 554, 862, 48);
+ twitterlabel.addMouseListener(new MouseAdapter()
+ {
+ public void mouseClicked(MouseEvent e)
+ {
+ twitterlabel.setCursor(new Cursor(Cursor.WAIT_CURSOR));
+ openLink(a.getTwitterLink());
+ twitterlabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ }
+ }
+ );
+ add(twitterlabel);
+
+ JLabel lblLinkedin = new JLabel("LinkedIn : ");
+ lblLinkedin.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblLinkedin.setFont(new Font("Segoe UI", Font.PLAIN, 20));
+ lblLinkedin.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ lblLinkedin.setBounds(24, 601, 211, 48);
+ add(lblLinkedin);
+
+ JLabel linkedinlabel = new JLabel("  "+a.getLinkedinLink()+"");
+ linkedinlabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+ linkedinlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ linkedinlabel.setForeground(new Color(65, 105, 225));
+ linkedinlabel.setFont(new Font("Segoe UI", Font.PLAIN, 20));
+ linkedinlabel.setToolTipText(a.getLinkedinLink());
+ linkedinlabel.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ linkedinlabel.setBounds(234, 601, 862, 48);
+ linkedinlabel.addMouseListener(new MouseAdapter()
+ {
+ public void mouseClicked(MouseEvent e)
+ {
+ linkedinlabel.setCursor(new Cursor(Cursor.WAIT_CURSOR));
+ openLink(a.getLinkedinLink());
+ linkedinlabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ }
+ }
+ );
+ add(linkedinlabel);
+ }
+
+ public void openLink(String link)
+ {
+ this.setCursor(new Cursor(Cursor.WAIT_CURSOR));
+ Desktop desktop=Desktop.getDesktop();
+ try {
+ desktop.browse(URI.create(link));
+ this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ JOptionPane.showMessageDialog(null, e.getMessage());
+
+ }
+ }
+}
diff --git a/src/collegeapplication/admin/EditAdminDetailsDialog.java b/src/collegeapplication/admin/EditAdminDetailsDialog.java
new file mode 100644
index 0000000..4160f17
--- /dev/null
+++ b/src/collegeapplication/admin/EditAdminDetailsDialog.java
@@ -0,0 +1,399 @@
+package collegeapplication.admin;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Dialog;
+import java.awt.FileDialog;
+import java.awt.Font;
+import java.awt.Image;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.IOException;
+
+import javax.imageio.ImageIO;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JPasswordField;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.SwingConstants;
+import javax.swing.UIManager;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.LineBorder;
+
+/*
+ * Title : EditAdminDetailsDialog.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : With the help of this file admin can edit collage details
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+@SuppressWarnings("serial")
+public class EditAdminDetailsDialog extends JDialog implements ActionListener {
+
+ private static EditAdminDetailsDialog dialog;
+ private final JPanel contentPanel = new JPanel();
+ private JTextField collagenamefield;
+ private JTextField emailidfield;
+ private JTextField contactnumberfield;
+ private JTextField websitefield;
+ private JPasswordField passwordfield;
+ private File file=new File("./assets/arcodding.png");
+ private String imagepath=null;
+ private JButton choosefilebutton;
+ private JTextArea addresstextarea;
+ private JButton createaccountbutton;
+ private JLabel Errorlabel;
+ private JScrollPane scrollpaneforaddress;
+ Admin a;
+ AdminMain am;
+
+ /**
+ * Launch the application.
+ */
+ public static void main(String[] args) {
+ try {
+ dialog = new EditAdminDetailsDialog(null,null);
+ dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+ dialog.setVisible(true);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Create the dialog.
+ */
+ public EditAdminDetailsDialog(Admin a,AdminMain am) {
+
+
+ super(dialog,"",Dialog.ModalityType.APPLICATION_MODAL);
+ this.am=am;
+ this.a=a;
+ setResizable(false);
+ setSize(570, 675);
+ getContentPane().setLayout(new BorderLayout());
+ contentPanel.setFont(new Font("Tahoma", Font.PLAIN, 18));
+ contentPanel.setBackground(new Color(255, 255, 255));
+ contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
+ getContentPane().add(contentPanel, BorderLayout.CENTER);
+ contentPanel.setLayout(null);
+
+ JLabel lblCreateAdminProfile = new JLabel("Edit Admin Profile ");
+ lblCreateAdminProfile.setOpaque(true);
+ lblCreateAdminProfile.setForeground(new Color(255, 255, 255));
+ lblCreateAdminProfile.setBackground(new Color(32, 178, 170));
+ lblCreateAdminProfile.setFont(new Font("Segoe UI", Font.BOLD, 25));
+ lblCreateAdminProfile.setHorizontalAlignment(SwingConstants.CENTER);
+ lblCreateAdminProfile.setBounds(0, 0, 564, 58);
+ contentPanel.add(lblCreateAdminProfile);
+
+ JLabel lblCollageName = new JLabel("Collage Name :");
+ lblCollageName.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ lblCollageName.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblCollageName.setBounds(10, 90, 146, 35);
+ contentPanel.add(lblCollageName);
+
+ collagenamefield = new JTextField(a.getCollageName());
+ collagenamefield.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ collagenamefield.setBounds(166, 88, 388, 38);
+ contentPanel.add(collagenamefield);
+ collagenamefield.setColumns(10);
+
+ JLabel lblAdress = new JLabel("Email ID :");
+ lblAdress.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblAdress.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ lblAdress.setBounds(10, 147, 146, 35);
+ contentPanel.add(lblAdress);
+
+ emailidfield = new JTextField(a.getEmailId());
+ emailidfield.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ emailidfield.setColumns(10);
+ emailidfield.setBounds(166, 145, 388, 38);
+ contentPanel.add(emailidfield);
+
+ JLabel lblContactNumber = new JLabel("Contact Number :");
+ lblContactNumber.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblContactNumber.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ lblContactNumber.setBounds(10, 208, 146, 35);
+ contentPanel.add(lblContactNumber);
+
+ contactnumberfield = new JTextField(a.getContactNumber());
+ contactnumberfield.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ contactnumberfield.setColumns(10);
+ contactnumberfield.setBounds(166, 205, 388, 38);
+ contentPanel.add(contactnumberfield);
+
+ JLabel lblWebsite = new JLabel("Website :");
+ lblWebsite.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblWebsite.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ lblWebsite.setBounds(10, 268, 146, 35);
+ contentPanel.add(lblWebsite);
+
+ websitefield = new JTextField(a.getWebsite());
+ websitefield.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ websitefield.setColumns(10);
+ websitefield.setBounds(166, 265, 388, 38);
+ contentPanel.add(websitefield);
+
+ JLabel lblPassword = new JLabel("Password :");
+ lblPassword.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblPassword.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ lblPassword.setBounds(10, 327, 146, 35);
+ contentPanel.add(lblPassword);
+
+ passwordfield = new JPasswordField(a.getPassword());
+ passwordfield.setBorder(new LineBorder(Color.GRAY));
+ passwordfield.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ passwordfield.setBounds(166, 328, 313, 38);
+
+ contentPanel.add(passwordfield);
+
+
+ JButton showandhidebutton = new JButton("show");
+ showandhidebutton.setForeground(new Color(255, 255, 255));
+ showandhidebutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ showandhidebutton.setFocusable(false);
+ showandhidebutton.setFocusPainted(false);
+ showandhidebutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ showandhidebutton.setBackground(new Color(32, 178, 170));
+ showandhidebutton.setBounds(483, 328, 71, 38);
+ showandhidebutton.addActionListener(e->
+ {
+ if(showandhidebutton.getText().equals("show"))
+ {
+ passwordfield.setEchoChar('\u0000');
+ showandhidebutton.setText("hide");
+ }
+ else
+ {
+ passwordfield.setEchoChar((Character)UIManager.get("PasswordField.echoChar"));
+ showandhidebutton.setText("show");
+ }
+ });
+ contentPanel.add(showandhidebutton);
+
+
+ JLabel lblAddress = new JLabel("Address :");
+ lblAddress.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblAddress.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ lblAddress.setBounds(10, 383, 146, 35);
+ contentPanel.add(lblAddress);
+
+ scrollpaneforaddress = new JScrollPane();
+ scrollpaneforaddress.setBorder(new LineBorder(new Color(130, 135, 144)));
+ scrollpaneforaddress.setBounds(166, 387, 388, 58);
+ contentPanel.add(scrollpaneforaddress);
+
+ addresstextarea = new JTextArea(a.getAddress());
+ scrollpaneforaddress.setViewportView(addresstextarea);
+ addresstextarea.setLineWrap(true);
+ addresstextarea.setBorder(new EmptyBorder(0, 0, 0, 0));
+ addresstextarea.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ addresstextarea.setRows(2);
+
+ JLabel logoimagelabel = new JLabel("");
+ logoimagelabel.setToolTipText("Logo");
+ logoimagelabel.setBorder(new LineBorder(Color.GRAY));
+ logoimagelabel.setIcon(new ImageIcon(a.getProfilePic(120, 120)));
+ logoimagelabel.setHorizontalAlignment(SwingConstants.CENTER);
+ logoimagelabel.setBounds(21, 480, 120, 120);
+ contentPanel.add(logoimagelabel);
+
+ JLabel lblLogo = new JLabel("Collage logo");
+ lblLogo.setFont(new Font("Segoe UI", Font.PLAIN, 16));
+ lblLogo.setBounds(166, 480, 111, 24);
+ contentPanel.add(lblLogo);
+
+ JLabel filesizelabel = new JLabel("127 KB");
+ filesizelabel.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ filesizelabel.setBounds(269, 480, 232, 24);
+ contentPanel.add(filesizelabel);
+
+ choosefilebutton = new JButton("Choose Logo");
+ choosefilebutton.setFont(new Font("Segoe UI", Font.PLAIN, 15));
+ choosefilebutton.setForeground(Color.BLACK);
+ choosefilebutton.addActionListener(this);
+ choosefilebutton.setFocusable(false);
+ choosefilebutton.setBackground(new Color(245, 245, 245));
+ choosefilebutton.setBounds(166, 520, 137, 35);
+ choosefilebutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ contentPanel.add(choosefilebutton);
+
+ JLabel filenamelabel = new JLabel("No File Choosen");
+ filenamelabel.setFont(new Font("Segoe UI", Font.PLAIN, 16));
+ filenamelabel.setBounds(308, 525, 246, 24);
+ contentPanel.add(filenamelabel);
+
+ JLabel filesizenote = new JLabel("Imagesize < 1024 KB");
+ filesizenote.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ filesizenote.setBounds(166, 566, 246, 24);
+ contentPanel.add(filesizenote);
+
+ createaccountbutton = new JButton("Update Details");
+ createaccountbutton.setFocusPainted(false);
+ createaccountbutton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+ createaccountbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ createaccountbutton.setForeground(new Color(255, 255, 255));
+ createaccountbutton.setBackground(new Color(32, 178, 170));
+ createaccountbutton.setFont(new Font("Segoe UI", Font.BOLD, 14));
+ createaccountbutton.setBounds(417, 600, 139, 37);
+ createaccountbutton.addActionListener(this);
+ contentPanel.add(createaccountbutton);
+
+ Errorlabel = new JLabel("This is required question !");
+ Errorlabel.setVisible(false);
+ Errorlabel.setForeground(Color.RED);
+ Errorlabel.setFont(new Font("Arial", Font.PLAIN, 14));
+ Errorlabel.setBounds(233, 45, 225, 17);
+ contentPanel.add(Errorlabel);
+
+
+ choosefilebutton.addActionListener(e->
+ {
+ FileDialog fd = new FileDialog(this, "Choose logo", FileDialog.LOAD);
+ fd.setDirectory("C:\\Downloads");
+ fd.setFile("*.jpeg;*.jpg;*.png;*.tiff;*.tif;*.gif;");
+ fd.setLocationRelativeTo(null);
+ fd.setVisible(true);
+ String strfilename = fd.getFile();
+ imagepath=fd.getDirectory()+strfilename;
+ if(!imagepath.isEmpty())
+ {
+ file=new File(imagepath);
+ }
+
+ if(file.getAbsolutePath().contains("null"))
+ {
+ file=new File("./assets/profilepicicon.jpg");
+ }
+ if (strfilename == null)
+ {
+
+ }
+ else
+ {
+ long bytes=file.length();
+ if(bytes<1048576)
+ {
+
+ try
+ {
+ filesizelabel.setText(bytes/1024+" KB");
+ filesizenote.setForeground(new Color(46,139,27));
+ filesizenote.setText("Image size < 1024 KB");
+ Image image = ImageIO.read(file);
+ logoimagelabel.setIcon(new ImageIcon(image.getScaledInstance(120, 120, Image.SCALE_SMOOTH)));
+ }
+ catch (IOException ex)
+ {
+ // TODO Auto-generated catch block
+ logoimagelabel.setIcon(new ImageIcon("./assets/profilepicicon.jpg"));
+ filenamelabel.setText("No file Choosen");
+ filesizelabel.setText("");
+ filesizenote.setForeground(Color.red);
+ filesizenote.setText("Image Not supported");
+ ex.printStackTrace();
+ }
+ filenamelabel.setText(file.getName());
+ }
+ else
+ {
+ logoimagelabel.setIcon(new ImageIcon("./assets/profilepicicon.jpg"));
+ filenamelabel.setText("No File Choosen");
+ filesizelabel.setText("");
+ filesizenote.setForeground(Color.red);
+ filesizenote.setText("Image size is greater than 1 MB");
+ }
+
+ }
+ }
+ );
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO Auto-generated method stub
+ if(e.getSource()==createaccountbutton)
+ {
+ if(collagenamefield.getText().isEmpty())
+ {
+ showerror(collagenamefield);
+ }
+ else if(emailidfield.getText().isEmpty())
+ {
+ showerror(emailidfield);
+ }
+ else if(contactnumberfield.getText().isEmpty())
+ {
+ showerror(contactnumberfield);
+ }
+ else if(websitefield.getText().isEmpty())
+ {
+ showerror(websitefield);
+ }
+ else if(passwordfield.getPassword().toString().isEmpty())
+ {
+ showerror(passwordfield);
+ }
+ else if(addresstextarea.getText().isEmpty())
+ {
+ showerror(scrollpaneforaddress);
+ }
+ else
+ {
+ Admin ad=new Admin();
+ ad.setCollageName(collagenamefield.getText());
+ ad.setEmailId(emailidfield.getText());
+ ad.setContactNumber(contactnumberfield.getText());
+ ad.setAddress(addresstextarea.getText());
+ ad.setPassword(String.valueOf(passwordfield.getPassword()));
+ ad.setWebsite(websitefield.getText());
+
+ if(file.getAbsolutePath().equals("C:\\Users\\Sohansinh Rathod\\eclipse-workspace\\Collage Data Management\\.\\assets\\arcodding.png"))
+ {
+ ad.setProfilePic(a.getProfilePic());
+ }
+ else {
+
+ try
+ {
+ ad.setProfilePic(ImageIO.read(file));
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ }
+ int result=new AdminData().updateAdminDetails(ad);
+ if(result>0)
+ {
+ am.adminprofilepanel.setVisible(false);
+ am.adminprofilepanel=new AdminProfilePanel(am);
+ am.adminprofilepanel.setLocation(am.panelx, am.panely);
+ am.adminprofilepanel.setVisible(true);
+ am.contentPane.add(am.adminprofilepanel);
+ am.setCollageDetails();
+
+ this.dispose();
+
+ }
+ }
+ }
+
+ }
+ public void showerror(JComponent tf)
+ {
+ Errorlabel.setVisible(true);
+ Errorlabel.setText("This is required question !");
+ Errorlabel.setBounds(tf.getX(), tf.getY()+tf.getHeight()-5, 400,26);
+ }
+}
diff --git a/src/collegeapplication/admin/EditAdminLinksDialog.java b/src/collegeapplication/admin/EditAdminLinksDialog.java
new file mode 100644
index 0000000..1e43b5a
--- /dev/null
+++ b/src/collegeapplication/admin/EditAdminLinksDialog.java
@@ -0,0 +1,156 @@
+package collegeapplication.admin;
+
+import java.awt.FlowLayout;
+
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JPanel;
+import javax.swing.border.EmptyBorder;
+import java.awt.Color;
+import java.awt.Dialog;
+
+import javax.swing.JLabel;
+import javax.swing.SwingConstants;
+import java.awt.Font;
+import javax.swing.border.MatteBorder;
+import javax.swing.JTextField;
+
+/*
+ * Title : EditAdminLinksDialog.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : With the help of this file admin can edit the social media links
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+@SuppressWarnings("serial")
+public class EditAdminLinksDialog extends JDialog {
+
+ private static EditAdminLinksDialog dialog;
+ private final JPanel contentPanel = new JPanel();
+ private JTextField facebookfield;
+ private JTextField instagramfield;
+ private JTextField twitterfield;
+ private JTextField linkedinfield;
+
+ /**
+ * Launch the application.
+ */
+ public static void main(String[] args) {
+ try {
+ dialog = new EditAdminLinksDialog(null,null);
+ dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+ dialog.setVisible(true);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Create the dialog.
+ */
+ public EditAdminLinksDialog(Admin a,AdminMain am) {
+
+ super(dialog,"",Dialog.ModalityType.APPLICATION_MODAL);
+ dialog=this;
+ setResizable(false);
+ getContentPane().setBackground(new Color(255, 255, 255));
+ setBounds(100, 100, 568, 342);
+ getContentPane().setLayout(null);
+
+ JLabel lblNewLabel = new JLabel("Edit Social Media Links");
+ lblNewLabel.setOpaque(true);
+ lblNewLabel.setBackground(new Color(32, 178, 170));
+ lblNewLabel.setForeground(new Color(255, 255, 255));
+ lblNewLabel.setFont(new Font("Segoe UI", Font.BOLD, 22));
+ lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
+ lblNewLabel.setBounds(0, 0, 552, 39);
+ getContentPane().add(lblNewLabel);
+
+ JLabel lblFaceBook = new JLabel("Face Book :");
+ lblFaceBook.setBorder(new EmptyBorder(0, 0, 0, 0));
+ lblFaceBook.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ lblFaceBook.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblFaceBook.setBounds(10, 50, 125, 39);
+ getContentPane().add(lblFaceBook);
+
+ facebookfield = new JTextField(a.getFacebookLink());
+ facebookfield.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ facebookfield.setBounds(145, 50, 397, 39);
+ getContentPane().add(facebookfield);
+ facebookfield.setColumns(10);
+
+ JLabel lblInstagram = new JLabel("Instagram :");
+ lblInstagram.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblInstagram.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ lblInstagram.setBorder(new EmptyBorder(0, 0, 0, 0));
+ lblInstagram.setBounds(10, 97, 125, 39);
+ getContentPane().add(lblInstagram);
+
+ JLabel lblTwitter = new JLabel("Twitter :");
+ lblTwitter.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblTwitter.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ lblTwitter.setBorder(new EmptyBorder(0, 0, 0, 0));
+ lblTwitter.setBounds(10, 144, 125, 39);
+ getContentPane().add(lblTwitter);
+
+ JLabel lblLinkedin = new JLabel("LinkedIn :");
+ lblLinkedin.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblLinkedin.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ lblLinkedin.setBorder(new EmptyBorder(0, 0, 0, 0));
+ lblLinkedin.setBounds(10, 192, 125, 39);
+ getContentPane().add(lblLinkedin);
+
+ instagramfield = new JTextField(a.getInstagramLink());
+ instagramfield.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ instagramfield.setColumns(10);
+ instagramfield.setBounds(145, 97, 397, 39);
+ getContentPane().add(instagramfield);
+
+ twitterfield = new JTextField(a.getTwitterLink());
+ twitterfield.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ twitterfield.setColumns(10);
+ twitterfield.setBounds(145, 144, 397, 39);
+ getContentPane().add(twitterfield);
+
+ linkedinfield = new JTextField(a.getLinkedinLink());
+ linkedinfield.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ linkedinfield.setColumns(10);
+ linkedinfield.setBounds(145, 195, 397, 39);
+ getContentPane().add(linkedinfield);
+
+ JButton updatelinksbutton = new JButton("Update Links");
+ updatelinksbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ updatelinksbutton.setForeground(new Color(255, 255, 255));
+ updatelinksbutton.setBackground(new Color(32, 178, 170));
+ updatelinksbutton.setFont(new Font("Segoe UI", Font.BOLD, 14));
+ updatelinksbutton.setBounds(403, 269, 139, 35);
+ updatelinksbutton.setFocusPainted(false);
+ updatelinksbutton.addActionListener(e->
+ {
+ Admin ad=new Admin();
+ ad.setFaceBookLink(facebookfield.getText());
+ ad.setInstagramLink(instagramfield.getText());
+ ad.setTwitterLink(twitterfield.getText());
+ ad.setLinkedinLink(linkedinfield.getText());
+ int result=new AdminData().updateAdminLink(ad);
+ if(result>0)
+ {
+ am.adminprofilepanel.setVisible(false);
+ am.adminprofilepanel=new AdminProfilePanel(am);
+ am.adminprofilepanel.setLocation(am.panelx, am.panely);
+ am.adminprofilepanel.setVisible(true);
+ am.contentPane.add(am.adminprofilepanel);
+ dialog.dispose();
+
+ }
+ });
+ getContentPane().add(updatelinksbutton);
+
+ JLabel label = new JLabel("");
+ label.setBorder(new MatteBorder(0, 0, 1, 0, (Color) new Color(192, 192, 192)));
+ label.setBounds(0, 242, 562, 14);
+ getContentPane().add(label);
+ contentPanel.setLayout(new FlowLayout());
+ contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
+
+ }
+}
diff --git a/src/collegeapplication/chat/ChatData.java b/src/collegeapplication/chat/ChatData.java
new file mode 100644
index 0000000..7877ec5
--- /dev/null
+++ b/src/collegeapplication/chat/ChatData.java
@@ -0,0 +1,417 @@
+package collegeapplication.chat;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.StringTokenizer;
+
+import collegeapplication.common.DataBaseConnection;
+import collegeapplication.cource.CourceData;
+import collegeapplication.faculty.Faculty;
+import collegeapplication.student.Student;
+
+/*
+ * Title : ChatData.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : Manages all the data related to chat
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+public class ChatData {
+
+ Connection con=DataBaseConnection.getConnection();
+
+
+ public int saveMessage(ChatUser u)
+ {
+ int result=0;
+ try
+ {
+ String query="insert into chat values(?,?,?,?,?,?,?,?)";
+ PreparedStatement pr=con.prepareStatement(query);
+ pr.setInt(1, u.getSr_no());
+ pr.setString(2, u.getFromUserId());
+ pr.setString(3, u.getFromUserName());
+ pr.setString(4, u.getToUserId());
+ pr.setString(5, u.getMessage());
+ pr.setString(6, u.getMessageTime());
+ pr.setString(7, u.getMessageDate());
+ pr.setString(8,"");
+ result=pr.executeUpdate();
+ pr.close();
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return result;
+ }
+ public ArrayList getMessages()
+ {
+ ArrayList list=new ArrayList();
+ try
+ {
+
+ String query="select * from chat";
+ Statement pr=con.createStatement();
+ ResultSet rs=pr.executeQuery(query);
+ while(rs.next())
+ {
+ ChatUser user=new ChatUser();
+ user.setSr_no(rs.getInt(1));
+ user.setFromUserID(rs.getString(2));
+ user.setFromUserName(rs.getString(3));
+ user.setToUserID(rs.getString(4));
+ user.setMessage(rs.getString(5));
+ user.setMessageTime(rs.getString(6));
+ user.setMessageDate(rs.getString(7));
+ user.setReadBy(rs.getString(8));
+ list.add(user);
+ }
+ pr.close();
+ rs.close();
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return list;
+ }
+ public ArrayList getUserMessages(ChatUser u)
+ {
+ ArrayList list=new ArrayList();
+ try
+ {
+
+ String query=null;
+ if(u.getToUserId().contains("Group"))
+ {
+ query="select * from chat where touserid='"+u.getToUserId()+"'";
+
+ }
+ else
+ {
+ query="select * from chat where (touserid='"+u.getToUserId()+"' and fromuserid='"+u.getFromUserId()+"') or (fromuserid='"+u.getToUserId()+"' and touserid='"+u.getFromUserId()+"')";
+ }
+ Statement pr=con.createStatement();
+ ResultSet rs=pr.executeQuery(query);
+ while(rs.next())
+ {
+ ChatUser user=new ChatUser();
+ user.setSr_no(rs.getInt(1));
+ user.setFromUserID(rs.getString(2));
+ user.setFromUserName(rs.getString(3));
+ user.setToUserID(rs.getString(4));
+ user.setMessage(rs.getString(5));
+ user.setMessageTime(rs.getString(6));
+ user.setMessageDate(rs.getString(7));
+ user.setReadBy(rs.getString(8));
+ list.add(user);
+ }
+ pr.close();
+ rs.close();
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return list;
+ }
+ public NewMessage getNewMessages(String fromuserid,String touserid)
+ {
+ NewMessage newmessage=new NewMessage();
+ String readbystr="";
+
+ try
+ {
+ String query=null;
+ if(touserid.contains("Group"))
+ {
+ query="select readby,message,fromuserid,messagetime,messagedate from chat where (touserid='"+touserid+"' and fromuserid!='"+fromuserid+"')";
+
+ }
+ else
+ {
+ query="select readby,message,fromuserid,messagetime,messagedate from chat where (touserid='"+fromuserid+"' and fromuserid='"+touserid+"')";
+ }
+ Statement pr=con.createStatement();
+ ResultSet rs=pr.executeQuery(query);
+ while(rs.next())
+ {
+ readbystr=rs.getString(1);
+ boolean isreaded=isReadBy(readbystr,fromuserid);
+ if(!isreaded)
+ {
+ newmessage.total++;
+
+ if(touserid.contains("Group"))
+ {
+ newmessage.message=rs.getString(3)+" : "+rs.getString(2);
+ }
+ else
+ {
+ newmessage.message=rs.getString(2);
+ }
+ newmessage.messagetime=rs.getString(5);
+ if(newmessage.messagetime.equals(NewMessage.getCurrentDate()))
+ {
+ newmessage.messagetime=rs.getString(4);
+ }
+ }
+
+ }
+ pr.close();
+ rs.close();
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ if(newmessage.message==null)
+ {
+ newmessage=getLastMessage(fromuserid, touserid);
+ }
+ return newmessage;
+ }
+ public String getReadBy(int sr_no)
+ {
+ try
+ {
+ String query="select readby from chat where sr_no="+sr_no;
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ return rs.getString(1);
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return null;
+ }
+ public NewMessage getLastMessage(String fromuserid,String touserid)
+ {
+ NewMessage newmessage=new NewMessage();
+ newmessage.message="Start new Conversion";
+ try
+ {
+ String query=null;
+ if(touserid.contains("Group"))
+ {
+ query="select message,fromuserid,messagetime,messagedate from chat where touserid='"+touserid+"'";
+
+ }
+ else
+ {
+ query="select message,fromuserid,messagetime,messagedate from chat where (touserid='"+touserid+"' and fromuserid='"+fromuserid+"') or (fromuserid='"+touserid+"' and touserid='"+fromuserid+"')";
+ }
+ Statement pr=con.createStatement();
+ ResultSet rs=pr.executeQuery(query);
+ while(rs.next())
+ {
+ if(touserid.contains("Group"))
+ {
+ String from=fromuserid.equals(rs.getString(2))?"You":rs.getString(2);
+ newmessage.message=from+" : "+rs.getString(1);
+ }
+ else
+ {
+ newmessage.message=rs.getString(1);
+ }
+ newmessage.messagetime=rs.getString(4);
+ if(newmessage.messagetime.equals(NewMessage.getCurrentDate()))
+ {
+ newmessage.messagetime=rs.getString(3);
+ }
+ }
+ pr.close();
+ rs.close();
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return newmessage;
+ }
+ public boolean isReadBy(String str,String fromuserid)
+ {
+ if(str.isEmpty())
+ {
+ return false;
+ }
+
+ StringTokenizer readby=new StringTokenizer(str,"#");
+ while(readby.hasMoreTokens())
+ {
+ if(readby.nextToken().equals(fromuserid))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void readBy(int sr_no,String readby)
+ {
+ try
+ {
+ String query="update chat set readby=? where sr_no="+sr_no;
+ PreparedStatement pr=con.prepareStatement(query);
+ pr.setString(1, readby);
+ pr.executeUpdate();
+ pr.close();
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ }
+ public void addReadBy(ArrayList list,String userid)
+ {
+ try
+ {
+ String query="update chat set readby=concat(readby,?,'#') where ";
+ query+=" sr_no="+list.get(0);
+ for(int i=1; i contactlist;
+ public static ArrayList contactinfo;
+ ChatMainPanel chatmainpanel;
+ public int location=0;
+ public String userid="";
+ ChatData chatdata=new ChatData();
+ Timer timer=new Timer(2000,this);
+ Image messagecount =null;
+
+
+ @Override
+ public Dimension getPreferredSize()
+ {
+ return new Dimension(330,location);
+ }
+ private ContactListPanel()
+ {
+ setLayout(null);
+ setBackground(Color.WHITE);
+ setSize(330,705);
+ contactinfo=new ArrayList();
+ contactlist=new ArrayList();
+ try
+ {
+ messagecount=ImageIO.read(new File("./assets/messagecount.png"));
+ }
+ catch(IOException exp)
+ {
+ exp.printStackTrace();
+ }
+ }
+ public ContactListPanel(AdminMain am,ChatMainPanel chatmainpanel) {
+
+ this();
+ this.chatmainpanel=chatmainpanel;
+ userid="Admin";
+ getAllcontacts();
+ timer.start();
+
+
+ }
+ public ContactListPanel(FacultyMain fm,ChatMainPanel chatmainpanel) {
+
+ this();
+ this.chatmainpanel=chatmainpanel;
+ userid=fm.f.getFacultyId()+"";
+ getContacts(fm.f.getCourceCode(),fm.f.getSemorYear(),""," and facultyid!="+fm.f.getFacultyId()+"");
+ timer.start();
+
+
+ }
+ public ContactListPanel(StudentMain sm,ChatMainPanel chatmainpanel) {
+
+ this();
+ this.chatmainpanel=chatmainpanel;
+ userid=sm.s.getUserId();
+ getContacts(sm.s.getCourceCode(),sm.s.getSemorYear()," and s.userid!='"+sm.s.getUserId()+"' ","");
+ timer.start();
+
+
+ }
+ //For Faculty or Student
+ public void getContacts(String courcecode,int sem,String slastcondition,String flastcondition)
+ {
+ //Adding groups
+ {
+ Admin a=new AdminData().getAdminData();
+ addLabel("Groups");
+ {
+ int members=new StudentData().getTotalStudentInCource(courcecode, sem)+new FacultyData().getTotalFaculaty(courcecode, sem)+1;
+ if(members>1)
+ {
+
+ Group group=new Group();
+ group.setCourceCode(courcecode);
+ group.setSem(sem);
+ group.setMembers(members);
+ group.setImage(a.getProfilePic());
+ String semoryear=new CourceData().getsemoryear(courcecode);
+ group.setGroupName(courcecode+" "+semoryear+"-"+sem+" Official Group");
+
+ JPanel contactlistpanel=createPanel(a.getProfilePic(),group.getGroupName(),group.getGroupName(),false);
+ contactlistpanel.setName(group.getGroupName()+"#"+group.getGroupName()+"#"+total);
+ contactlistpanel.setLocation(0, location);
+ location+=60;
+ total++;
+ contactlist.add(contactlistpanel);
+ add(contactlistpanel);
+
+
+ ContactInfo cf=new ContactInfo();
+ cf.setGroup(group);
+ contactinfo.add(cf);
+
+ }
+ }
+ if(!flastcondition.isEmpty())
+ {
+ int members=new FacultyData().getTotalFaculaty(courcecode, sem);
+ if(members>1)
+ {
+
+ Group group=new Group();
+ group.setCourceCode(courcecode);
+ group.setSem(sem);
+ group.setMembers(members);
+ group.setImage(a.getProfilePic());
+ String semoryear=new CourceData().getsemoryear(courcecode);
+ group.setGroupName(courcecode+" "+semoryear+"-"+sem+" Faculties Group");
+
+ JPanel contactlistpanel=createPanel(a.getProfilePic(),group.getGroupName(),group.getGroupName(),false);
+ contactlistpanel.setName(group.getGroupName()+"#"+group.getGroupName()+"#"+total);
+ contactlistpanel.setLocation(0, location);
+ location+=60;
+ total++;
+ contactlist.add(contactlistpanel);
+ add(contactlistpanel);
+
+
+ ContactInfo cf=new ContactInfo();
+ cf.setGroup(group);
+ contactinfo.add(cf);
+
+ }
+ }
+ if(!slastcondition.isEmpty())
+ {
+ int members=new StudentData().getTotalStudentInCource(courcecode, sem);
+ if(members>1)
+ {
+
+ Group group=new Group();
+ group.setCourceCode(courcecode);
+ group.setSem(sem);
+ group.setMembers(members);
+ group.setImage(a.getProfilePic());
+ String semoryear=new CourceData().getsemoryear(courcecode);
+ group.setGroupName(courcecode+" "+semoryear+"-"+sem+" Students Group");
+
+ JPanel contactlistpanel=createPanel(a.getProfilePic(),group.getGroupName(),group.getGroupName(),false);
+ contactlistpanel.setName(group.getGroupName()+"#"+group.getGroupName()+"#"+total);
+ contactlistpanel.setLocation(0, location);
+ location+=60;
+ total++;
+ contactlist.add(contactlistpanel);
+ add(contactlistpanel);
+
+
+ ContactInfo cf=new ContactInfo();
+ cf.setGroup(group);
+ contactinfo.add(cf);
+
+ }
+ }
+
+
+ }
+ //Adding Admin contact
+ {
+ addLabel("Admin");
+ Admin a=new AdminData().getAdminData();
+ JPanel contactlistpanel=createPanel(a.getProfilePic(),"Principal","Admin",a.getActiveStatus());
+ contactlistpanel.setName("Principal-Admin"+"#"+"Admin"+"#"+total);
+ total++;
+ contactlistpanel.setLocation(0, location);
+ location+=60;
+ contactlist.add(contactlistpanel);
+ add(contactlistpanel);
+ ContactInfo cf=new ContactInfo();
+ cf.setAdmin(new AdminData().getAdminData());
+ contactinfo.add(cf);
+ }
+
+ //Adding Faculties
+ {
+
+ ArrayList flist=new FacultyData().getTotalFaculty(" where courcecode='"+courcecode+"' and semoryear="+sem+flastcondition);
+ if(flist.size()>0)
+ {
+ addLabel("Faculties");
+ }
+ for(Faculty f: flist)
+ {
+ JPanel contactlistpanel=createPanel(f.getProfilePic(),f.getFacultyName()+"-"+f.getFacultyId(),f.getFacultyId()+"",f.getActiveStatus());
+ contactlistpanel.setName(f.getFacultyName()+"-"+f.getFacultyId()+" faculty#"+f.getFacultyId()+"#"+total);
+ total++;
+ contactlistpanel.setLocation(0, location);
+ location+=60;
+ contactlist.add(contactlistpanel);
+ add(contactlistpanel);
+ ContactInfo cf=new ContactInfo();
+ cf.setFaculty(f);
+ contactinfo.add(cf);
+ }
+ }
+
+// Adding Students
+ {
+
+ ArrayList slist=new StudentData().getStudentsDetails(" where courcecode='"+courcecode+"' and semoryear="+sem+slastcondition);
+ if(slist.size()>0)
+ {
+ addLabel("Students");
+ }
+ for(Student s: slist)
+ {
+ JPanel contactlistpanel=createPanel(s.getProfilePic(),s.getFullName()+"-"+s.getUserId(),s.getUserId(),s.getActiveStatus());
+ contactlistpanel.setName(s.getFullName()+"-"+s.getUserId()+" student#"+s.getUserId()+"#"+total);
+ total++;
+ contactlistpanel.setLocation(0, location);
+ location+=60;
+ contactlist.add(contactlistpanel);
+ add(contactlistpanel);
+ ContactInfo cf=new ContactInfo();
+ cf.setStudent(s);
+ contactinfo.add(cf);
+ }
+
+ }
+ }
+
+ //For Admin
+ public void getAllcontacts()
+ {
+
+ //Adding groups
+ {
+ String[] str=new CourceData().getCourcecode();
+ Admin a=new AdminData().getAdminData();
+ boolean added=false;
+ for(String cource:str)
+ {
+
+
+ int sem=new CourceData().getTotalsemoryear(new CourceData().getcourcename(cource));
+ String semoryear=new CourceData().getsemoryear(cource);
+ for(int i=1; i<=sem; i++)
+ {
+
+ int members=new StudentData().getTotalStudentInCource(cource, i)+new FacultyData().getTotalFaculaty(cource, i)+1;
+ if(members>1)
+ {
+ if(!added)
+ {
+ addLabel("Groups");
+ added=true;
+ }
+ Group group=new Group();
+ group.setCourceCode(cource);
+ group.setSem(i);
+ group.setMembers(members);
+ group.setImage(a.getProfilePic());
+ group.setGroupName(cource+" "+semoryear+"-"+i+" Official Group");
+
+ JPanel contactlistpanel=createPanel(a.getProfilePic(),group.getGroupName(),group.getGroupName(),false);
+ contactlistpanel.setName(group.getGroupName()+"#"+group.getGroupName()+"#"+total);
+ contactlistpanel.setLocation(0, location);
+ location+=60;
+ total++;
+ contactlist.add(contactlistpanel);
+ add(contactlistpanel);
+ ContactInfo cf=new ContactInfo();
+ cf.setGroup(group);
+
+ contactinfo.add(cf);
+ }
+ }
+ }
+ }
+
+ //Adding Faculties
+ {
+
+ ArrayList flist=new FacultyData().getTotalFaculty("");
+ if(flist.size()>0)
+ {
+ addLabel("Faculties");
+
+ }
+ for(Faculty f: flist)
+ {
+ JPanel contactlistpanel=createPanel(f.getProfilePic(),f.getFacultyName()+"-"+f.getFacultyId(),f.getFacultyId()+"",f.getActiveStatus());
+ contactlistpanel.setName(f.getFacultyName()+"-"+f.getFacultyId()+"faculty#"+f.getFacultyId()+"#"+total);
+ contactlistpanel.setLocation(0, location);
+ location+=60;
+ total++;
+ contactlist.add(contactlistpanel);
+ add(contactlistpanel);
+ ContactInfo cf=new ContactInfo();
+ cf.setFaculty(f);
+ contactinfo.add(cf);
+ }
+ }
+
+// Adding Students
+ {
+
+ ArrayList slist=new StudentData().getStudentsDetails("");
+ if(slist.size()>0)
+ {
+ addLabel("Students");
+ }
+ for(Student s: slist)
+ {
+ JPanel contactlistpanel=createPanel(s.getProfilePic(),s.getFullName()+"-"+s.getUserId(),s.getUserId(),s.getActiveStatus());
+ contactlistpanel.setName(s.getFullName()+"-"+s.getUserId()+" student#"+s.getUserId()+"#"+total);
+ contactlistpanel.setLocation(0, location);
+ location+=60;
+ total++;
+ contactlist.add(contactlistpanel);
+ add(contactlistpanel);
+ ContactInfo cf=new ContactInfo();
+ cf.setStudent(s);
+ contactinfo.add(cf);
+ }
+
+ }
+
+ }
+ public void addLabel(String name)
+ {
+ JLabel grouplabel=new JLabel(name);
+ grouplabel.setFont(new Font("Segoe UI",Font.PLAIN,17));
+ grouplabel.setForeground(new Color(25,25,25));
+ grouplabel.setBackground(new Color(245,245,245));
+ grouplabel.setBounds(0, location,330,25);
+ location+=25;
+ grouplabel.setOpaque(true);
+ grouplabel.setBorder(new EmptyBorder(3,15,3,240));
+ add(grouplabel);
+ }
+ public JPanel createPanel(Image image,String username,String userid,boolean isactive)
+ {
+ JPanel usernamepanel=new JPanel();
+ usernamepanel.setLayout(null);
+ usernamepanel.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ usernamepanel.setSize(330,60);
+ usernamepanel.setBackground(Color.white);
+ usernamepanel.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+
+ if(e.getButton()==MouseEvent.BUTTON1)
+ {
+ chatmainpanel.searchfield.setFocusable(false);
+ JPanel panel=(JPanel) e.getSource();
+
+ for(JPanel p:contactlist)
+ {
+ p.setBackground(Color.white);
+ for(Component c:p.getComponents())
+ {
+ if(c.getName()!=null && c.getName().equals("lastmessage"))
+ {
+ if(!c.getForeground().equals(Color.DARK_GRAY))
+ {
+ c.setForeground(Color.gray);
+ }
+ }
+ else if(c.getName()!=null &&c.getName().equals("messagetime")&&c.getForeground().equals(new Color(30,178,170)))
+ {
+
+ c.setForeground(Color.gray);
+ }
+ else if(c.getName()!=null&&c.getName().equals("username"))
+ {
+ c.setForeground(Color.DARK_GRAY);
+ }
+ else if(c.getName()!=null && c.getName().equals("messagetime"))
+ {
+ c.setForeground(Color.gray);
+ }
+
+ }
+ }
+ panel.setBackground(new Color(30,178,170));
+ for(Component c:panel.getComponents())
+ {
+ c.setForeground(Color.white);
+ if(c.getName()!=null && c.getName().equals("lastmessage"))
+ {
+ c.setFont(new Font("Segoe UI",Font.PLAIN,13));
+ }
+ if(c.getName()!=null && c.getName().equals("totalnewmessages"))
+ {
+ c.setVisible(false);
+ }
+
+ }
+ StringTokenizer str=new StringTokenizer(panel.getName(),"#");
+ str.nextToken();
+ str.nextToken();
+ int pos=Integer.parseInt(str.nextToken());
+ ContactInfo cf=contactinfo.get(pos);
+ String s=cf.getClassName();
+ if(s.equals("Student"))
+ {
+ chatmainpanel.chatinfopanel.setData(cf.getStudent());
+ chatmainpanel.chatpanel.setToUserData(s,cf.getStudent().getUserId(), cf.getStudent().getFullName()+"-"+cf.getStudent().getUserId(), cf.getStudent().getProfilePic(), cf.getStudent().getLastLogin(),cf.getStudent().getActiveStatus());
+ }
+ else if(s.equals("Faculty"))
+ {
+ chatmainpanel.chatinfopanel.setData(cf.getFaculty());
+ chatmainpanel.chatpanel.setToUserData(s,cf.getFaculty().getFacultyId()+"",cf.getFaculty().getFacultyName()+"-"+cf.getFaculty().getFacultyId(),cf.getFaculty().getProfilePic(),cf.getFaculty().getLastLogin(),cf.getFaculty().getActiveStatus());
+ }
+ else if(s.equals("Group"))
+ {
+ chatmainpanel.chatinfopanel.setData(cf.getGroup());
+ chatmainpanel.chatpanel.setToUserData(s,cf.getGroup().getGroupName(),cf.getGroup().getGroupName(),cf.getGroup().getImage(), cf.getGroup().getMembers()+" Members",false);
+ }
+ else
+ {
+ chatmainpanel.chatinfopanel.setData(cf.getAdmin());
+ chatmainpanel.chatpanel.setToUserData(s,"Admin", "Principal", cf.getAdmin().getProfilePic() ,cf.getAdmin().getLastLogin(),cf.getAdmin().getActiveStatus());
+ }
+ }
+ }
+ public void mouseEntered(MouseEvent e)
+ {
+ JPanel panel=(JPanel) e.getSource();
+ if(panel.getBackground()==Color.white)
+ {
+ panel.setBackground(new Color(245,245,245));
+ }
+ }
+ public void mouseExited(MouseEvent e)
+ {
+ JPanel panel=(JPanel) e.getSource();
+ if(panel.getBackground().equals(new Color(245,245,245)))
+ {
+ panel.setBackground(Color.white);
+ }
+ }
+
+
+ });
+
+
+ BufferedImage profilepic=ImageUtil.toBufferedImage(image.getScaledInstance(50, 50, Image.SCALE_SMOOTH));
+ profilepic=ImageUtil.makeRoundedCorner(profilepic, 50);
+ JLabel profilepiclabel=new JLabel(new ImageIcon(profilepic));
+ profilepiclabel.setLocation(10, 5);
+ profilepiclabel.setSize(50, 50);
+ JLabel onlinestatus = new JLabel(new ImageIcon("./assets/onlinestatus.png"));
+ onlinestatus.setBounds(45, 40, 15, 15);
+ usernamepanel.add(onlinestatus);
+ onlinestatus.setName("onlinestatus");
+ onlinestatus.setVisible(false);
+ if(isactive)
+ {
+ onlinestatus.setVisible(true);
+ }
+ usernamepanel.add(profilepiclabel);
+
+
+ JLabel usernamelabel=new JLabel(username);
+ usernamelabel.setName("username");
+ usernamelabel.setFont(new Font("Segoe UI",Font.BOLD,15));
+ usernamelabel.setLocation(70, 5);
+ usernamelabel.setSize(180, 30);
+ usernamepanel.add(usernamelabel);
+
+ JLabel messagetimelabel=new JLabel();
+ messagetimelabel.setForeground(new Color(30,178,170));
+ messagetimelabel.setFont(new Font("Segoe UI",Font.PLAIN,10));
+ messagetimelabel.setLocation(250, 6);
+ messagetimelabel.setName("messagetime");
+ messagetimelabel.setSize(70, 30);
+ messagetimelabel.setHorizontalAlignment(JLabel.RIGHT);
+ usernamepanel.add(messagetimelabel);
+
+
+
+ JLabel totalnewmessages=new JLabel();
+ totalnewmessages.setLocation(290, 30);
+ totalnewmessages.setText("0");
+ totalnewmessages.setName("totalnewmessages");
+ totalnewmessages.setSize(60,22);
+ totalnewmessages.setFont(new Font("Arial",Font.BOLD,10));
+ totalnewmessages.setForeground(Color.white);
+ totalnewmessages.setHorizontalTextPosition(JLabel.CENTER);
+ totalnewmessages.setVerticalTextPosition(JLabel.CENTER);
+ usernamepanel.add(totalnewmessages);
+
+
+ JLabel lastlabel=new JLabel();
+ lastlabel.setForeground(Color.gray);
+ lastlabel.setName("lastmessage");
+ lastlabel.setFont(new Font("Segoe UI",Font.PLAIN,13));
+ if(!userid.isEmpty())
+ {
+ NewMessage newmessage=chatdata.getNewMessages(this.userid,userid);
+ if(newmessage.total==0)
+ {
+ messagetimelabel.setForeground(Color.gray);
+ lastlabel.setFont(new Font("Segoe UI",Font.PLAIN,13));
+ lastlabel.setForeground(Color.gray);
+ totalnewmessages.setVisible(false);
+ messagetimelabel.setText(newmessage.messagetime);
+ }
+ else
+ {
+ lastlabel.setFont(new Font("Segoe UI",Font.BOLD,13));
+ lastlabel.setForeground(Color.DARK_GRAY);
+ totalnewmessages.setVisible(true);
+ totalnewmessages.setText(newmessage.total+"");
+ messagetimelabel.setText(newmessage.messagetime);
+ if(newmessage.total>99)
+ {
+ totalnewmessages.setIcon(new ImageIcon(messagecount.getScaledInstance(24+totalnewmessages.getText().length(), 24, Image.SCALE_SMOOTH)));
+ }
+ else
+ {
+ totalnewmessages.setIcon(new ImageIcon(messagecount));
+ }
+ }
+
+ lastlabel.setText(newmessage.message);
+ }
+ else
+ {
+ lastlabel.setText("Start new Conversion");
+ }
+ lastlabel.setBackground(Color.white);
+ lastlabel.setSize(220, 30);
+ lastlabel.setLocation(70, 25);
+ usernamepanel.add(lastlabel);
+
+
+ return usernamepanel;
+
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ // TODO Auto-generated method stub
+
+ for(int i=0; i99)
+ {
+ ((JLabel) c).setIcon(new ImageIcon(messagecount.getScaledInstance(24+((JLabel) c).getText().length(), 24, Image.SCALE_SMOOTH)));
+ }
+ else
+ {
+ ((JLabel) c).setIcon(new ImageIcon(messagecount));
+ }
+ }
+
+ }
+ }
+ }
+
+ if(p.getBackground().equals(new Color(30,178,170)))
+ {
+ for(Component c:p.getComponents())
+ {
+ c.setForeground(Color.white);
+ if(c.getName()!=null && c.getName().equals("lastmessage"))
+ {
+ c.setFont(new Font("Segoe UI",Font.PLAIN,13));
+ }
+ if(c.getName()!=null && c.getName().equals("totalnewmessages"))
+ {
+ c.setVisible(false);
+ }
+ }
+ }
+ }
+ this.repaint();
+ }
+ public void filterContact(String search)
+ {
+ this.removeAll();
+ this.setVisible(false);
+ location=0;
+ boolean group=false;
+ boolean students=false;
+ boolean faculties=false;
+ for(JPanel p:contactlist)
+ {
+ StringTokenizer str=new StringTokenizer(p.getName(),"#");
+ String contactname=str.nextToken();
+ contactname=contactname.toLowerCase();
+ search=search.trim();
+ search=search.toLowerCase();
+ if(contactname.contains(search))
+ {
+ if(contactname.contains("group")&&!group)
+ {
+ addLabel("Groups");
+ group=true;
+ }
+ if(contactname.contains("student")&&!contactname.contains("group")&&!students)
+ {
+ addLabel("Students");
+ students=true;
+ }
+ if(contactname.contains("faculty")&&!contactname.contains("group")&&!faculties)
+ {
+ addLabel("Faculties");
+ faculties=true;
+ }
+ if(contactname.contains("admin")&&contactname.contains("principal"))
+ {
+ addLabel("Admin");
+
+ }
+ add(p);
+ p.setLocation(0, location);
+ location+=60;
+
+
+ }
+
+
+ }
+ this.setVisible(true);
+
+
+ }
+}
+class ContactInfo
+{
+ private Faculty faculty;
+ private Student student;
+ private Group group;
+ private Admin admin;
+
+ public void setFaculty(Faculty faculty)
+ {
+ this.faculty=faculty;
+ }
+ public void setStudent(Student student)
+ {
+ this.student=student;
+ }
+ public void setGroup(Group group)
+ {
+ this.group=group;
+ }
+ public void setAdmin(Admin admin)
+ {
+ this.admin=admin;
+ }
+
+ public Faculty getFaculty()
+ {
+ return faculty;
+ }
+ public Student getStudent()
+ {
+ return student;
+ }
+ public Group getGroup()
+ {
+ return group;
+ }
+ public Admin getAdmin()
+ {
+ return admin;
+ }
+ public String getClassName()
+ {
+ if(student!=null)
+ {
+ return "Student";
+ }
+ else if(faculty!=null)
+ {
+ return "Faculty";
+ }
+ else if(group!=null)
+ {
+ return "Group";
+ }
+ else if(admin!=null)
+ {
+ return "Admin";
+ }
+
+ return null;
+ }
+}
diff --git a/src/collegeapplication/chat/Group.java b/src/collegeapplication/chat/Group.java
new file mode 100644
index 0000000..cc437e6
--- /dev/null
+++ b/src/collegeapplication/chat/Group.java
@@ -0,0 +1,59 @@
+package collegeapplication.chat;
+
+import java.awt.Image;
+
+/*
+ * Title : Group.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : To binding all the data related to group
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+class Group
+{
+ private Image groupimage;
+ private String groupname;
+ private int members;
+ private String courcecode;
+ private int semoryear;
+ public void setImage(Image image)
+ {
+ this.groupimage=image;
+ }
+ public void setGroupName(String groupname)
+ {
+ this.groupname=groupname;
+ }
+ public void setCourceCode(String courcecode)
+ {
+ this.courcecode=courcecode;
+ }
+ public void setSem(int semoryear)
+ {
+ this.semoryear=semoryear;
+ }
+ public void setMembers(int members)
+ {
+ this.members=members;
+ }
+ public Image getImage()
+ {
+ return groupimage;
+ }
+ public String getGroupName()
+ {
+ return groupname;
+ }
+ public String getCourceCode()
+ {
+ return courcecode;
+ }
+ public int getSemorYear()
+ {
+ return semoryear;
+ }
+ public int getMembers()
+ {
+ return members;
+ }
+
+}
\ No newline at end of file
diff --git a/src/collegeapplication/chat/Server.java b/src/collegeapplication/chat/Server.java
new file mode 100644
index 0000000..c298626
--- /dev/null
+++ b/src/collegeapplication/chat/Server.java
@@ -0,0 +1,83 @@
+package collegeapplication.chat;
+
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.Timer;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.event.ActionListener;
+import java.net.BindException;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.Vector;
+
+@SuppressWarnings("serial")
+public class Server extends JFrame implements Runnable
+{
+
+ public final static int port=2003;
+ public static Vector clientlist=new Vector();
+
+ public Server()
+ {
+ setSize(400,200);
+ setTitle("Chat Server");
+ this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ this.getContentPane().setBackground(Color.white);
+
+ JLabel label=new JLabel();
+ label.setHorizontalAlignment(JLabel.CENTER);
+ label.setBackground(Color.white);
+ label.setFont(new Font("Cambria Math", Font.PLAIN, 18));
+ label.setText("Active Users : "+clientlist.size());
+ getContentPane().add(label,BorderLayout.CENTER);
+ ActionListener countuser=e->
+ {
+ label.setText("Active Users : "+clientlist.size());
+ };
+ Timer timer=new Timer(1000,countuser);
+ timer.start();
+ this.setVisible(true);
+ }
+
+ public static void main(String args[])
+ {
+ Server server=new Server();
+ Thread thread=new Thread(server);
+ thread.start();
+
+ }
+
+ @Override
+ public void run() {
+ // TODO Auto-generated method stub
+ try
+ {
+ @SuppressWarnings("resource")
+ ServerSocket server=new ServerSocket(Server.port);
+ System.out.println("Server Started");
+ while(true)
+ {
+ Socket socket=server.accept();
+
+ ClientHandler client=new ClientHandler(socket);
+ client.position=clientlist.size();
+ clientlist.add(client);
+ System.out.println("Active User :"+clientlist.size());
+ Thread thread=new Thread(client);
+ thread.start();
+ }
+
+ }
+ catch(BindException exp)
+ {
+ System.exit(0);
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ }
+}
diff --git a/src/collegeapplication/chat/SubChatPanel.java b/src/collegeapplication/chat/SubChatPanel.java
new file mode 100644
index 0000000..2e84166
--- /dev/null
+++ b/src/collegeapplication/chat/SubChatPanel.java
@@ -0,0 +1,757 @@
+package collegeapplication.chat;
+
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.EventQueue;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Insets;
+import java.awt.RenderingHints;
+import java.awt.Shape;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.geom.Area;
+import java.awt.geom.Rectangle2D;
+import java.awt.geom.RoundRectangle2D;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.ConnectException;
+import java.net.Socket;
+import java.net.SocketException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.StringTokenizer;
+
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextField;
+import javax.swing.Timer;
+import javax.swing.UIManager;
+import javax.swing.border.AbstractBorder;
+import javax.swing.border.EmptyBorder;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import javax.swing.text.Document;
+
+import collegeapplication.admin.AdminData;
+import collegeapplication.common.ScrollPaneUtil;
+import collegeapplication.common.TimeUtil;
+import collegeapplication.faculty.FacultyData;
+import collegeapplication.student.StudentData;
+
+
+/*
+ * Title : SubChatPanel.java ** Part of chat panel
+ * Created by : Ajaysinh Rathod
+ * Purpose : All the messages which user sending and receiving are handling here
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+@SuppressWarnings("serial")
+public class SubChatPanel extends JPanel implements ActionListener,Runnable {
+
+ Box vertical = Box.createVerticalBox();
+ private JTextField messagefield;
+ private ChatUser user=null;
+ private ObjectInputStream reader;
+ public Socket socket;
+ private ObjectOutputStream writer;
+ private JPanel chat;
+ private JScrollPane chatscroll;
+ public JButton send;
+ private String date="";
+ private JLabel progresslabel;
+ private JLabel hintlabel;
+ public ArrayList messagestatus=new ArrayList();
+
+
+ /**
+ * Launch the application.
+ */
+ public static void main(String[] args) {
+ EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ try {
+ SubChatPanel frame = new SubChatPanel(null);
+ frame.setVisible(true);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ }
+
+ /**
+ * Create the frame.
+ */
+
+
+ public SubChatPanel(ChatUser user) {
+
+
+
+ setLayout(null);
+ UIManager.put("ScrollBarUI", "com.sun.java.swing.plaf.windows.WindowsScrollBarUI");
+ setBounds(100, 100, 498, 640);
+ this.setBorder(new EmptyBorder(0,0,0,0));
+ chatscroll = new JScrollPane();
+ chatscroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
+ chatscroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ chatscroll.setBounds(0, 0, this.getWidth(), this.getHeight()-59);
+ chatscroll.setAutoscrolls(true);
+ chatscroll.setBorder(this.getBorder());
+ chatscroll.setOpaque(false);
+ chatscroll.getViewport().setOpaque(false);
+ chatscroll.getVerticalScrollBar().setPreferredSize(new Dimension(5,0));
+ chatscroll.getVerticalScrollBar().setUnitIncrement(80);
+ add(chatscroll);
+
+ chat = new JPanel();
+ chatscroll.setViewportView(chat);;
+ chat.setLayout(new BorderLayout());
+ chat.setBounds(0, 70, 405,351);
+ chat.setOpaque(false);
+ JPanel bottonpanel = new JPanel()
+ {
+ protected void paintComponent(Graphics g)
+ {
+ g.setColor( getBackground() );
+ g.fillRect(0, 0, getWidth(), getHeight());
+ super.paintComponent(g);
+ }
+ };
+ bottonpanel.setBounds(0, this.getHeight()-54, this.getWidth(), 60);
+ bottonpanel.setBackground(new Color(255,255,255));
+ add(bottonpanel);
+ bottonpanel.setLayout(null);
+
+ messagefield = new JTextField() {
+ @Override protected void paintComponent(Graphics g) {
+ if (!isOpaque() && getBorder() instanceof RoundedCornerBorder) {
+ Graphics2D g2 = (Graphics2D) g.create();
+ g2.setPaint(getBackground());
+ g2.fill(((RoundedCornerBorder) getBorder()).getBorderShape(
+ 0, 0, getWidth() - 1, getHeight() - 1));
+ g2.dispose();
+ }
+ super.paintComponent(g);
+ }
+ @Override public void updateUI() {
+ super.updateUI();
+ setOpaque(false);
+ setBorder(new RoundedCornerBorder());
+ }
+ };
+ messagefield.setLayout(new BorderLayout());
+ messagefield.setBounds(5, 10, bottonpanel.getWidth()-60, 36);
+ messagefield.setFocusable(true);
+ messagefield.getDocument().addDocumentListener(new MyDocumentListener());
+ messagefield.addMouseListener(new MouseAdapter()
+ {
+
+ public void mousePressed(MouseEvent e)
+ {
+ messagefield.grabFocus();
+ messagefield.setFocusable(true);
+ }
+ });
+
+ bottonpanel.add(messagefield);
+ messagefield.setForeground(Color.DARK_GRAY);
+ messagefield.setBackground(new Color(255,255,255));
+ messagefield.setFont(new Font("Segoe UI Emoji", Font.PLAIN, 16));
+ messagefield.setColumns(10);
+ hintlabel=new JLabel("Write a message...");
+ hintlabel.setFont(messagefield.getFont());
+ hintlabel.setForeground(new Color(100,100,100));
+ messagefield.add(hintlabel,BorderLayout.LINE_START);
+
+
+ send = new JButton(new ImageIcon("./assets/sendmessage.png"));
+ send.setFocusPainted(false);
+ send.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ send.setBorder(this.getBorder());
+ send.setBounds(bottonpanel.getWidth()-40, 10, 30, 36);
+ send.addActionListener(this);
+ send.setBackground(new Color(255,255,255));
+ send.setContentAreaFilled(false);
+ bottonpanel.add(send);
+
+ progresslabel=new JLabel("Loading...");
+ progresslabel.setSize(100,38);
+ progresslabel.setBackground(new Color(255,255,255,120));
+ progresslabel.setOpaque(true);
+ progresslabel.setVisible(false);
+ progresslabel.setHorizontalAlignment(JLabel.CENTER);
+ progresslabel.setLocation(200, 31);
+ add(progresslabel);
+
+ JLabel label =new JLabel(new ImageIcon("./assets/chatbg.jpg"));
+ label.setBounds(0,0,this.getWidth(),this.getHeight());
+ add(label);
+ this.user=user;
+
+
+ getMessages();
+ this.setVisible(true);;
+
+ Timer timer=new Timer(1000,new MessageStatusActionListener());
+ timer.start();
+ try
+ {
+ socket=new Socket("localhost",Server.port);
+ writer=new ObjectOutputStream(socket.getOutputStream());
+ reader=new ObjectInputStream(socket.getInputStream());
+ }
+ catch(ConnectException e)
+ {
+ JOptionPane.showMessageDialog(null,"Enable to connect with the server","Error",JOptionPane.ERROR_MESSAGE);
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+
+ }
+
+ public void getMessages()
+ {
+ ArrayList list=new ChatData().getUserMessages(user);
+ ArrayList readbylist=new ArrayList();
+ if(list.size()>100)
+ {
+ progresslabel.setVisible(true);
+ }
+ this.repaint();
+ EventQueue.invokeLater(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ // TODO Auto-generated method stub
+ for(int i=0; i0)
+ {
+ new ChatData().addReadBy(readbylist,user.getFromUserId());
+ }
+ }
+
+ });
+
+
+
+ }
+ public void sendmessage()
+ {
+ if(socket!=null)
+ {
+ try
+ {
+
+ String sendmessage=messagefield.getText();
+ sendmessage=sendmessage.trim();
+ if(!sendmessage.isEmpty())
+ {
+ Date date=new Date();
+ this.user.setMessage(sendmessage,date);
+ user.setSr_no(new ChatData().getNewSr_no());
+ new ChatData().saveMessage(this.user);
+ writer.writeObject(this.user);
+ writer.reset();
+ }
+ }
+ catch(SocketException exp)
+ {
+ JOptionPane.showMessageDialog(null,"Enable to connect with the server","Error",JOptionPane.ERROR_MESSAGE);
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ messagefield.setText("");
+ }
+ }
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ sendmessage();
+
+ }
+
+ public void RightSidePanel(ChatUser u)
+ {
+
+ JPanel panel=formatPanel(u,true);
+
+ JPanel right=new JPanel(new BorderLayout());
+ right.setBorder(new EmptyBorder(5,0,5,0));
+ right.add(panel,BorderLayout.LINE_END);
+ right.setBackground(new Color(0,0,0,0));
+ right.setBorder(new EmptyBorder(5,5,0,5));
+ right.setName(u.getSr_no()+"");
+
+ vertical.add(right);
+ chat.add(vertical,BorderLayout.PAGE_START);
+ ScrollPaneUtil.scrollToBottom(chatscroll);
+ this.repaint();
+ this.revalidate();
+ }
+
+ public void LeftSidePanel(ChatUser u)
+ {
+ JPanel panel=formatPanel(u,false);
+ JPanel right=new JPanel(new BorderLayout());
+ right.add(panel,BorderLayout.LINE_START);
+ right.setBackground(new Color(255,255,255,0));
+ right.setBorder(new EmptyBorder(5,5,0,5));
+ right.setName(u.getSr_no()+"");
+ vertical.add(right);
+ chat.add(vertical,BorderLayout.PAGE_START);
+ ScrollPaneUtil.scrollToBottom(chatscroll);
+ this.repaint();
+ this.revalidate();
+
+ }
+ public void addLabel(String text)
+ {
+
+ JPanel p=new JPanel();
+ p.setLayout(new FlowLayout());
+ p.setBackground(new Color(240,240,240,0));
+ p.setBorder(new EmptyBorder(5,0,5,0));
+ p.setOpaque(true);
+
+ JLabel specialnote=new JLabel();
+ if(text.length()>40)
+ {
+ specialnote.setText(""+text+"
");
+ }
+ else
+ {
+ specialnote.setText(text);
+ }
+ specialnote.setBorder(new EmptyBorder(2,20,3,20));
+ specialnote.setBackground(new Color(240,240,240,200));
+ specialnote.setForeground(Color.black);
+ specialnote.setOpaque(true);
+ specialnote.setFont(new Font("Segoe UI",Font.PLAIN,15));
+ p.add(specialnote);
+ vertical.add(p);
+ chat.add(vertical,BorderLayout.PAGE_START);
+ ScrollPaneUtil.scrollToBottom(chatscroll);
+ this.repaint();
+ this.revalidate();
+ }
+
+ public JPanel formatPanel(ChatUser u,boolean from)
+ {
+ //Creating panel of message
+ if(!u.getMessageDate().equals(date))
+ {
+ int diff=TimeUtil.getDayDifference(u.getMessageDate(),NewMessage.getCurrentDate());
+ if(diff==0)
+ {
+ addLabel("TODAY");
+ }
+ else if(diff==1)
+ {
+ addLabel("YESTERDAY");
+ }
+ else
+ {
+ addLabel(u.getMessageDate());
+ }
+ date=u.getMessageDate();
+ }
+ JPanel p=new JPanel();
+ p.setBorder(new EmptyBorder(5,0,5,0));
+ p.setLayout(new BoxLayout(p,BoxLayout.Y_AXIS));
+ p.setBackground(new Color(240,240,240));
+
+
+ //Adding username to panel
+ JLabel username=new JLabel();
+ if(!from)
+ {
+ if(user.getToUserId().contains("Group"))
+ {
+ username.setText(u.getFromUserName());
+ }
+
+ }
+ username.setHorizontalAlignment(JLabel.LEFT);
+ username.setBorder(new EmptyBorder(0,0,5,20));
+ username.setForeground(new Color(0,139,139));
+ username.setFont(new Font("Segoe UI",Font.BOLD,14));
+ p.add(username);
+
+ //Adding message to panel
+ JLabel messagelabel=new JLabel();
+ messagelabel.setFont(new Font("Segoe UI Emoji",Font.PLAIN,16));
+ messagelabel.setHorizontalTextPosition(JLabel.CENTER);
+ messagelabel.setVerticalTextPosition(JLabel.BOTTOM);
+ if(u.getMessage().length()<40)
+ {
+ messagelabel.setText(u.getMessage());
+ }
+ else
+ {
+ messagelabel.setText(""+u.getMessage()+"
");
+ }
+ messagelabel.setForeground(Color.black);
+ messagelabel.setBorder(new EmptyBorder(0,0,2,20));
+ p.add(messagelabel);
+
+ //Adding time to panel
+
+ //Creating panel of time
+ JPanel timepanel=new JPanel(new BorderLayout());
+ JLabel timelabel=new JLabel(u.getMessageTime());
+ timepanel.setBackground(p.getBackground());
+ timelabel.setFont(new Font("Segoe UI",Font.PLAIN,10));
+ timelabel.setForeground(Color.gray);
+ timepanel.add(timelabel,BorderLayout.LINE_END);
+ timepanel.setBorder(new EmptyBorder(2,0,0,2));
+ timelabel.setHorizontalAlignment(JLabel.CENTER);
+ p.add(timepanel);
+ if(from)
+ {
+ p.setBackground(new Color(20,130,130));
+ messagelabel.setForeground(Color.white);
+ timelabel.setForeground(new Color(245,245,245));
+ timepanel.setBackground(p.getBackground());
+ timelabel.setIcon(new ImageIcon("./assets/singletick.png"));
+ timelabel.setVerticalTextPosition(JLabel.CENTER);
+ timepanel.setOpaque(false);
+ timelabel.setHorizontalTextPosition(JLabel.LEFT);
+ timelabel.setBorder(new EmptyBorder(0,0,0,3));
+ if(!user.getToUserId().contains("Group"))
+ {
+
+ StringTokenizer read=new StringTokenizer(u.getReadBy(),"#");
+ boolean contain=false;
+ while(read.hasMoreTokens())
+ {
+ String str=read.nextToken();
+ if(str.equals(user.getToUserId()))
+ {
+
+ contain=true;
+ break;
+ }
+
+ }
+ if(contain)
+ {
+ timelabel.setIcon(new ImageIcon("./assets/doubletickblue.png"));
+ }
+ else
+ {
+ messagestatus.add(new MessageStatus(u,timelabel));
+ if(user.getUserProfile().equals("Student"))
+ {
+ if(new StudentData().isActive(user.getToUserId()))
+ {
+ timelabel.setIcon(new ImageIcon("./assets/doubletick.png"));
+ }
+ }
+ else if(user.getUserProfile().equals("Faculty"))
+ {
+ if(new FacultyData().isActive(user.getToUserId()))
+ {
+ timelabel.setIcon(new ImageIcon("./assets/doubletick.png"));
+ }
+ }
+ else if(user.getUserProfile().equals("Admin"))
+ {
+ if(new AdminData().isActive())
+ {
+ timelabel.setIcon(new ImageIcon("./assets/doubletick.png"));
+ }
+ }
+ }
+ }
+
+
+ }
+
+
+ return p;
+ }
+
+ @Override
+ public void run()
+ {
+
+ try
+ {
+ ChatUser u=null;
+ while(socket!=null&&!socket.isClosed()&&(u=(ChatUser)reader.readObject())!=null)
+ {
+ if(u.getFromUserId().equals(user.getFromUserId())&&u.getToUserId().equals(user.getToUserId()))
+ {
+ this.RightSidePanel(u);
+ }
+ else if(u.getToUserId().equals(user.getFromUserId())&&u.getFromUserId().equals(user.getToUserId()))
+ {
+ new ChatData().readBy(u.getSr_no(), u.getReadBy()+user.getFromUserId()+"#");
+ this.LeftSidePanel(u);
+ }
+ else if(u.getToUserId().equals(user.getToUserId())&&u.getToUserId().contains("Group"))
+ {
+ new ChatData().readBy(u.getSr_no(), u.getReadBy()+user.getFromUserId()+"#");
+ this.LeftSidePanel(u);
+ }
+
+ }
+
+ }
+ catch(SocketException exp)
+ {
+
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ class MessageStatusActionListener implements ActionListener
+ {
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ for(int i=0; i
+ {
+ System.out.println(s.getPassword());
+ if(oldpasswordfield.getText().isEmpty())
+ {
+ showerror(oldpasswordfield);
+ }
+ else if(!s.comparePassword(oldpasswordfield.getText()))
+ {
+ showerror(oldpasswordfield);
+ lblError.setText("Old password doesn't match.");
+ }
+ else if(newpasswordfield.getText().isEmpty())
+ {
+ showerror(newpasswordfield);
+ }
+ else if(newpasswordfield2.getText().isEmpty())
+ {
+ showerror(newpasswordfield2);
+ }
+ else if(!newpasswordfield.getText().equals(newpasswordfield2.getText()))
+ {
+ showerror(newpasswordfield2);
+ lblError.setText("password doesn't match");
+ }
+ else
+ {
+ int result=new StudentData().changePassword(s.getUserId(), newpasswordfield.getText());
+ if(result>0)
+ {
+ JOptionPane.showMessageDialog(null, "Password updated","Message",JOptionPane.INFORMATION_MESSAGE);
+ this.dispose();
+ }
+
+ }
+ });
+
+ }
+ @SuppressWarnings("deprecation")
+ public ChangePasswordDialog(Faculty f)
+ {
+ this();
+ changepasswordbutton.addActionListener(e->
+ {
+ if(oldpasswordfield.getText().isEmpty())
+ {
+ showerror(oldpasswordfield);
+ }
+ else if(!f.comparePassword(oldpasswordfield.getText()))
+ {
+ showerror(oldpasswordfield);
+ lblError.setText("Old password doesn't match.");
+ }
+ else if(newpasswordfield.getText().isEmpty())
+ {
+ showerror(newpasswordfield);
+ }
+ else if(newpasswordfield2.getText().isEmpty())
+ {
+ showerror(newpasswordfield2);
+ }
+ else if(!newpasswordfield.getText().equals(newpasswordfield2.getText()))
+ {
+ showerror(newpasswordfield2);
+ lblError.setText("password doesn't match");
+ }
+ else
+ {
+ int result=new FacultyData().changePassword(f.getFacultyId()+"", newpasswordfield.getText());
+ if(result>0)
+ {
+ JOptionPane.showMessageDialog(null, "Password updated","Message",JOptionPane.INFORMATION_MESSAGE);
+ this.dispose();
+ }
+
+ }
+ });
+
+ }
+ public ChangePasswordDialog() {
+ setModalityType(ModalityType.APPLICATION_MODAL);
+ setResizable(false);
+ getContentPane().setBackground(Color.WHITE);
+ setBounds(100, 100, 528, 354);
+ getContentPane().setLayout(null);
+
+ headinglabel = new JLabel("Change Password");
+ headinglabel.setBackground(new Color(32, 178, 170));
+ headinglabel.setOpaque(true);
+ headinglabel.setFocusable(true);
+ headinglabel.setForeground(Color.WHITE);
+ headinglabel.setFont(new Font("Segoe UI", Font.BOLD, 20));
+ headinglabel.setHorizontalAlignment(SwingConstants.CENTER);
+ headinglabel.setBounds(0, 0, 523, 51);
+ getContentPane().add(headinglabel);
+
+ JLabel label1 = new JLabel("Enter old Password");
+ label1.setFont(new Font("Segoe UI", Font.PLAIN, 16));
+ label1.setBounds(10, 76, 173, 33);
+ getContentPane().add(label1);
+
+ JLabel label2 = new JLabel("Enter new password");
+ label2.setFont(new Font("Segoe UI", Font.PLAIN, 16));
+ label2.setBounds(10, 139, 173, 33);
+ getContentPane().add(label2);
+
+ JLabel label3 = new JLabel("Re-enter new password");
+ label3.setFont(new Font("Segoe UI", Font.PLAIN, 16));
+ label3.setBounds(10, 194, 173, 40);
+ getContentPane().add(label3);
+
+ oldpasswordfield = new JPasswordField();
+ oldpasswordfield.setBorder(new LineBorder(new Color(171, 173, 179)));
+ oldpasswordfield.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ oldpasswordfield.setBounds(193, 75, 248, 40);
+ getContentPane().add(oldpasswordfield);
+
+ newpasswordfield = new JPasswordField();
+ newpasswordfield.setBorder(new LineBorder(new Color(171, 173, 179)));
+ newpasswordfield.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ newpasswordfield.setBounds(193, 135, 248, 40);
+ getContentPane().add(newpasswordfield);
+
+ newpasswordfield2 = new JPasswordField();
+ newpasswordfield2.setBorder(new LineBorder(new Color(171, 173, 179)));
+ newpasswordfield2.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ newpasswordfield2.setBounds(193, 197, 248, 40);
+ getContentPane().add(newpasswordfield2);
+
+
+
+ changepasswordbutton = new JButton("Change");
+ changepasswordbutton.setFocusable(false);
+ changepasswordbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ changepasswordbutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ changepasswordbutton.setForeground(new Color(255, 255, 255));
+ changepasswordbutton.setBackground(new Color(32, 178, 170));
+ changepasswordbutton.setBounds(377, 281, 137, 33);
+ getContentPane().add(changepasswordbutton);
+
+ JLabel lblNewLabel_1 = new JLabel("");
+ lblNewLabel_1.setBorder(new MatteBorder(0, 0, 1, 0, (Color) new Color(192, 192, 192)));
+ lblNewLabel_1.setBounds(0, 256, 523, 14);
+ getContentPane().add(lblNewLabel_1);
+
+ JButton oldshowbutton = new JButton("show");
+ oldshowbutton.setForeground(new Color(255, 255, 255));
+ oldshowbutton.setFont(new Font("Segoe UI", Font.BOLD, 14));
+ oldshowbutton.setBackground(new Color(32, 178, 170));
+ oldshowbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ oldshowbutton.setBounds(445, 74, 70, 40);
+ oldshowbutton.setFocusable(false);
+ oldshowbutton.addActionListener(e->
+ {
+ if(oldshowbutton.getText().equals("show"))
+ {
+ oldpasswordfield.setEchoChar('\u0000');
+ oldshowbutton.setText("hide");
+ }
+ else if(oldshowbutton.getText().equals("hide"))
+ {
+ oldpasswordfield.setEchoChar((Character)UIManager.get("PasswordField.echoChar"));
+ oldshowbutton.setText("show");
+ }
+ }
+ );
+ getContentPane().add(oldshowbutton);
+
+ JButton newshowbutton = new JButton("show");
+ newshowbutton.setForeground(Color.WHITE);
+ newshowbutton.setFont(new Font("Segoe UI", Font.BOLD, 14));
+ newshowbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ newshowbutton.setBackground(new Color(32, 178, 170));
+ newshowbutton.setBounds(445, 135, 70, 40);
+ newshowbutton.setFocusable(false);
+ newshowbutton.addActionListener(e->
+ {
+ if(newshowbutton.getText().equals("show"))
+ {
+ newpasswordfield.setEchoChar('\u0000');
+ newshowbutton.setText("hide");
+ }
+ else if(newshowbutton.getText().equals("hide"))
+ {
+ newpasswordfield.setEchoChar((Character)UIManager.get("PasswordField.echoChar"));
+ newshowbutton.setText("show");
+ }
+ }
+ );
+ getContentPane().add(newshowbutton);
+
+ JButton new2showbutton = new JButton("show");
+ new2showbutton.setForeground(Color.WHITE);
+ new2showbutton.setFont(new Font("Segoe UI", Font.BOLD, 14));
+ new2showbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ new2showbutton.setBackground(new Color(32, 178, 170));
+ new2showbutton.setBounds(445, 197, 70, 40);
+ new2showbutton.setFocusable(false);
+ new2showbutton.addActionListener(e->
+ {
+ if(new2showbutton.getText().equals("show"))
+ {
+ newpasswordfield2.setEchoChar('\u0000');
+ new2showbutton.setText("hide");
+ }
+ else if(new2showbutton.getText().equals("hide"))
+ {
+ newpasswordfield2.setEchoChar((Character)UIManager.get("PasswordField.echoChar"));
+ newshowbutton.setText("show");
+ }
+ });
+ getContentPane().add(new2showbutton);
+ contentPanel.setLayout(new FlowLayout());
+ contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
+
+ lblError=new JLabel("This is required question !");
+ lblError.setBorder(new MatteBorder(0, 0, 0, 0, (Color) new Color(255, 0, 0)));
+ lblError.setForeground(new Color(255, 0, 0));
+ lblError.setFont(new Font("Candara", Font.PLAIN, 15));
+ lblError.setVisible(false);
+ lblError.setBounds(211,134,355,21);
+ getContentPane().add(lblError);
+ }
+ public void showerror(JComponent tf)
+ {
+ lblError.setVisible(true);
+ lblError.setText("This is required question !");
+ lblError.setBounds(tf.getX(), tf.getY()+tf.getHeight()-5, 400,26);
+ }
+}
diff --git a/src/collegeapplication/common/DataBaseConnection.java b/src/collegeapplication/common/DataBaseConnection.java
new file mode 100644
index 0000000..9c63bf6
--- /dev/null
+++ b/src/collegeapplication/common/DataBaseConnection.java
@@ -0,0 +1,67 @@
+package collegeapplication.common;
+
+import java.sql.*;
+
+/*
+ * Title : DataBaseConnection.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : For database connection
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+public class DataBaseConnection {
+
+ static Connection con=null;
+ public static Connection getConnection()
+ {
+ if(con!=null)
+ {
+ return con;
+ }
+ else
+ {
+ try
+ {
+ String url="jdbc:mysql://localhost:3306/collegedata";
+ String uname="root";
+ String password="";
+ Class.forName("com.mysql.jdbc.Driver");
+ con=DriverManager.getConnection(url,uname,password);
+ return con;
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ return con;
+ }
+ }
+ }
+ public static boolean checkconnection()
+ {
+
+ try
+ {
+ String url="jdbc:mysql://localhost:3306/collegedata";
+ String uname="root";
+ String password="";
+ Class.forName("com.mysql.jdbc.Driver");
+ con=DriverManager.getConnection(url,uname,password);
+ return true;
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ return false;
+ }
+ }
+ public static void closeConnection()
+ {
+ try {
+ con.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/src/collegeapplication/common/HintPasswordField.java b/src/collegeapplication/common/HintPasswordField.java
new file mode 100644
index 0000000..35a90b6
--- /dev/null
+++ b/src/collegeapplication/common/HintPasswordField.java
@@ -0,0 +1,101 @@
+package collegeapplication.common;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+import javax.swing.JLabel;
+import javax.swing.JPasswordField;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import javax.swing.text.Document;
+
+
+/*
+ * Title : HintPasswordField.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : For giving hint to user in password field
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+@SuppressWarnings("serial")
+public class HintPasswordField extends JPasswordField {
+
+
+ private JLabel hintlabel;
+/**
+ *
+ */
+
+ public HintPasswordField(String hint,Color hintforegroundcolor)
+ {
+ this(hint);
+ hintlabel.setForeground(hintforegroundcolor);
+ }
+ public HintPasswordField(String hint) {
+
+ hint=hint.trim();
+
+ setForeground(Color.DARK_GRAY);
+ setLayout(new BorderLayout());
+ hintlabel=new JLabel(hint);
+ hintlabel.setFont(new Font("Segoe UI",Font.PLAIN,18));
+ hintlabel.setForeground(new Color(100,100,100));
+ add(hintlabel,BorderLayout.LINE_START);
+ this.getDocument().addDocumentListener(new MyDocumentListener());
+
+ this.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ JPasswordField field=(JPasswordField) e.getSource();
+ field.setFocusable(true);
+ }
+ }
+ );
+ this.addKeyListener(new KeyAdapter()
+ {
+ @Override
+ public void keyPressed(KeyEvent e)
+ {
+ if(e.getKeyCode()==KeyEvent.VK_ENTER)
+ {
+ setFocusable(false);
+ }
+ }
+ }
+
+ );
+ }
+ private class MyDocumentListener implements DocumentListener
+ {
+ public void insertUpdate(DocumentEvent e)
+ {
+ updateLog(e);
+ }
+ public void removeUpdate(DocumentEvent e)
+ {
+ updateLog(e);
+ }
+ public void changedUpdate(DocumentEvent e)
+ {
+ //Plain text components do not fire these events
+ }
+ public void updateLog(DocumentEvent e)
+ {
+ Document doc = (Document)e.getDocument();
+ if(doc.getLength()==0)
+ {
+ hintlabel.setVisible(true);
+ }
+ else
+ {
+ hintlabel.setVisible(false);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/collegeapplication/common/HintTextField.java b/src/collegeapplication/common/HintTextField.java
new file mode 100644
index 0000000..921445b
--- /dev/null
+++ b/src/collegeapplication/common/HintTextField.java
@@ -0,0 +1,119 @@
+package collegeapplication.common;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+import javax.swing.JLabel;
+import javax.swing.JTextField;
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import javax.swing.text.Document;
+
+/*
+ * Title : HintTextField.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : For giving hint to user in text field
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+@SuppressWarnings("serial")
+public class HintTextField extends JTextField {
+
+
+ private JLabel hintlabel;
+/**
+ *
+ */
+
+ public HintTextField(String hint,Color hintforegroundcolor)
+ {
+ this(hint);
+ hintlabel.setForeground(hintforegroundcolor);
+ }
+ public HintTextField(String hint) {
+
+ hint=hint.trim();
+
+ setForeground(Color.DARK_GRAY);
+ setLayout(new BorderLayout());
+ hintlabel=new JLabel(hint);
+ hintlabel.setFont(new Font("Segoe UI",Font.PLAIN,18));
+ hintlabel.setForeground(new Color(100,100,100));
+ add(hintlabel,BorderLayout.LINE_START);
+ this.getDocument().addDocumentListener(new MyDocumentListener());
+
+ this.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ JTextField field=(JTextField) e.getSource();
+ field.setFocusable(true);
+ }
+ }
+ );
+ this.addKeyListener(new KeyAdapter()
+ {
+ @Override
+ public void keyPressed(KeyEvent e)
+ {
+ if(e.getKeyCode()==KeyEvent.VK_ENTER)
+ {
+ setFocusable(false);
+ }
+ }
+ }
+
+ );
+
+// this.addFocusListener(new FocusAdapter() {
+//
+// @Override
+// public void focusGained(FocusEvent e) {
+// if (getText().equals(hint)) {
+// setText("");
+// } else {
+// setText(getText());
+//
+// }
+// }
+//
+// @Override
+// public void focusLost(FocusEvent e) {
+// if (getText().equals(hint)|| getText().length()==0) {
+// setText(hint);
+// } else {
+// setText(getText());
+// }
+// }
+// });
+
+ }
+ private class MyDocumentListener implements DocumentListener {
+ public void insertUpdate(DocumentEvent e) {
+ updateLog(e, "inserted into");
+ }
+ public void removeUpdate(DocumentEvent e) {
+ updateLog(e, "removed from");
+ }
+ public void changedUpdate(DocumentEvent e) {
+ //Plain text components do not fire these events
+ }
+ public void updateLog(DocumentEvent e, String action)
+ {
+ Document doc = (Document)e.getDocument();
+ if(doc.getLength()==0)
+ {
+ hintlabel.setVisible(true);
+ }
+ else
+ {
+ hintlabel.setVisible(false);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/collegeapplication/common/HomePanel.java b/src/collegeapplication/common/HomePanel.java
new file mode 100644
index 0000000..c8603fd
--- /dev/null
+++ b/src/collegeapplication/common/HomePanel.java
@@ -0,0 +1,292 @@
+package collegeapplication.common;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Image;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.IOException;
+
+import javax.imageio.ImageIO;
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingConstants;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.LineBorder;
+
+import collegeapplication.admin.Admin;
+import collegeapplication.cource.CourceData;
+import collegeapplication.faculty.Faculty;
+import collegeapplication.faculty.FacultyData;
+import collegeapplication.student.Student;
+import collegeapplication.student.StudentData;
+import collegeapplication.subject.SubjectData;
+
+/*
+ * Title : HomePanel.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : Home Page
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+@SuppressWarnings("serial")
+public class HomePanel extends JPanel implements ActionListener {
+ /**
+ *
+ */
+ private JPanel homeheaderpanel;
+ private JLabel totalstudentlabel, totalfaculitieslabel, totalcourcelabel, totallectureslabel;
+ public JLabel lastloginlabel;
+ private JLabel timedifflabel;
+ private JLabel welcomelabel;
+ private JLabel totalnotificationlabel;
+ private JPanel notificationpanel;
+ private JPanel courcespanel;
+ private JPanel faculitiespanel;
+ private JPanel studentspanel;
+ int pos[]= {20,294,568,842};
+ private JPanel subjectpanel;
+ /**
+ * Create the panel.
+ */
+ private HomePanel() {
+ setBorder(new EmptyBorder(0, 0, 0, 0));
+ setBackground(Color.WHITE);
+ setForeground(Color.WHITE);
+ this.setSize(1116, 705);
+ setLayout(null);
+
+
+
+
+ notificationpanel = new JPanel();
+ notificationpanel.setBorder(new LineBorder(new Color(192, 192, 192), 3));
+ notificationpanel.setBounds(20, 244, 253, 247);
+ add(notificationpanel);
+ notificationpanel.setBackground(new Color(255, 255, 255));
+ notificationpanel.setLayout(null);
+ notificationpanel.setVisible(false);
+
+ totalnotificationlabel = new JLabel("0");
+ totalnotificationlabel.setForeground(new Color(128, 128, 128));
+ totalnotificationlabel.setFont(new Font("Tahoma", Font.BOLD, 25));
+ totalnotificationlabel.setHorizontalAlignment(SwingConstants.CENTER);
+ totalnotificationlabel.setBounds(10, 174, 233, 35);
+ notificationpanel.add(totalnotificationlabel);
+
+ JLabel lblNotification = new JLabel("Notification");
+ lblNotification.setFont(new Font("Segoe UI", Font.BOLD, 25));
+ lblNotification.setForeground(new Color(128, 128, 128));
+ lblNotification.setHorizontalAlignment(SwingConstants.CENTER);
+ lblNotification.setHorizontalTextPosition(JLabel.CENTER);
+ lblNotification.setVerticalTextPosition(JLabel.BOTTOM);
+ lblNotification.setBounds(10, 31, 233, 142);
+ notificationpanel.add(lblNotification);
+ lblNotification.setIcon(new ImageIcon(".//assets//notificationhomepage.png"));
+
+ courcespanel = new JPanel();
+ courcespanel.setBorder(new LineBorder(new Color(192, 192, 192), 3));
+ courcespanel.setBounds(20, 244, 253, 247);
+ add(courcespanel);
+ courcespanel.setBackground(new Color(255, 255, 255));
+ courcespanel.setLayout(null);
+
+ totalcourcelabel = new JLabel("0");
+ totalcourcelabel.setForeground(new Color(128, 128, 128));
+ totalcourcelabel.setFont(new Font("Tahoma", Font.BOLD, 25));
+ totalcourcelabel.setHorizontalAlignment(SwingConstants.CENTER);
+ totalcourcelabel.setBounds(10, 174, 233, 35);
+ courcespanel.add(totalcourcelabel);
+
+ JLabel lblCources = new JLabel("Cources");
+ lblCources.setFont(new Font("Segoe UI", Font.BOLD, 25));
+ lblCources.setForeground(new Color(128, 128, 128));
+ lblCources.setHorizontalAlignment(SwingConstants.CENTER);
+ lblCources.setHorizontalTextPosition(JLabel.CENTER);
+ lblCources.setVerticalTextPosition(JLabel.BOTTOM);
+ lblCources.setBounds(10, 31, 233, 142);
+ courcespanel.add(lblCources);
+ lblCources.setIcon(new ImageIcon(".//assets//courceshomepage.png"));
+
+ studentspanel = new JPanel();
+ studentspanel.setBorder(new LineBorder(Color.LIGHT_GRAY, 3));
+ studentspanel.setLayout(null);
+ studentspanel.setBackground(Color.WHITE);
+ studentspanel.setBounds(294, 244, 253, 247);
+ add(studentspanel);
+
+ totalstudentlabel = new JLabel("0");
+ totalstudentlabel.setText(new StudentData().getTotalStudents() + "");
+ totalstudentlabel.setHorizontalAlignment(SwingConstants.CENTER);
+ totalstudentlabel.setForeground(Color.GRAY);
+
+ totalstudentlabel.setFont(new Font("Tahoma", Font.BOLD, 25));
+ totalstudentlabel.setBounds(10, 174, 233, 35);
+ studentspanel.add(totalstudentlabel);
+
+ JLabel lblStudents = new JLabel("Students");
+ lblStudents.setHorizontalAlignment(SwingConstants.CENTER);
+ lblStudents.setForeground(Color.GRAY);
+ lblStudents.setIcon(null);
+ lblStudents.setFont(new Font("Segoe UI", Font.BOLD, 25));
+ lblStudents.setBounds(10, 32, 233, 144);
+ lblStudents.setHorizontalTextPosition(JLabel.CENTER);
+ lblStudents.setVerticalTextPosition(JLabel.BOTTOM);
+ studentspanel.add(lblStudents);
+ lblStudents.setIcon(new ImageIcon(".//assets//studenthomepage.png"));
+
+ faculitiespanel = new JPanel();
+ faculitiespanel.setBorder(new LineBorder(Color.LIGHT_GRAY, 3));
+ faculitiespanel.setLayout(null);
+ faculitiespanel.setBackground(Color.WHITE);
+ faculitiespanel.setBounds(568, 244, 253, 247);
+ add(faculitiespanel);
+
+ totalfaculitieslabel = new JLabel("0");
+ totalfaculitieslabel.setBackground(Color.WHITE);
+ totalfaculitieslabel.setHorizontalAlignment(SwingConstants.CENTER);
+ totalfaculitieslabel.setForeground(Color.GRAY);
+ totalfaculitieslabel.setFont(new Font("Tahoma", Font.BOLD, 25));
+ totalfaculitieslabel.setBounds(10, 174, 233, 35);
+ faculitiespanel.add(totalfaculitieslabel);
+
+ JLabel lblFaculities = new JLabel("Faculities");
+ lblFaculities.setHorizontalAlignment(SwingConstants.CENTER);
+ lblFaculities.setForeground(Color.GRAY);
+ lblFaculities.setFont(new Font("Segoe UI", Font.BOLD, 25));
+ lblFaculities.setBounds(10, 34, 233, 140);
+ lblFaculities.setHorizontalTextPosition(JLabel.CENTER);
+ lblFaculities.setVerticalTextPosition(JLabel.BOTTOM);
+ faculitiespanel.add(lblFaculities);
+ lblFaculities.setIcon(new ImageIcon(".//assets//facultyhomepage.png"));
+
+ subjectpanel = new JPanel();
+ subjectpanel.setBorder(new LineBorder(Color.LIGHT_GRAY, 3));
+ subjectpanel.setLayout(null);
+ subjectpanel.setBackground(Color.WHITE);
+ subjectpanel.setBounds(842, 244, 253, 247);
+ add(subjectpanel);
+
+ totallectureslabel = new JLabel("0");
+
+ totallectureslabel.setHorizontalAlignment(SwingConstants.CENTER);
+ totallectureslabel.setForeground(Color.GRAY);
+ totallectureslabel.setFont(new Font("Tahoma", Font.BOLD, 25));
+ totallectureslabel.setBounds(10, 174, 233, 35);
+ subjectpanel.add(totallectureslabel);
+
+ JLabel lblLectures = new JLabel("Subjects");
+ lblLectures.setHorizontalAlignment(SwingConstants.CENTER);
+ lblLectures.setForeground(Color.GRAY);
+ lblLectures.setFont(new Font("Segoe UI", Font.BOLD, 25));
+ lblLectures.setBounds(10, 40, 233, 141);
+ lblLectures.setIconTextGap(10);
+ lblLectures.setHorizontalTextPosition(JLabel.CENTER);
+ lblLectures.setVerticalTextPosition(JLabel.BOTTOM);
+ subjectpanel.add(lblLectures);
+ try {
+ Image image=ImageIO.read(new File(".//assets//subjects2.png"));
+ lblLectures.setIcon(new ImageIcon(image.getScaledInstance(85, 85, Image.SCALE_SMOOTH)));
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ homeheaderpanel = new JPanel();
+ homeheaderpanel.setBorder(new EmptyBorder(0, 0, 0, 0));
+ homeheaderpanel.setBackground(new Color(32, 178, 170));
+ homeheaderpanel.setLayout(null);
+ homeheaderpanel.setBounds(10, 0, 1096, 279);
+ add(homeheaderpanel);
+
+ welcomelabel = new JLabel("Welcome");
+ welcomelabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ welcomelabel.setFont(new Font("Segoe UI", Font.BOLD, 30));
+ welcomelabel.setForeground(Color.WHITE);
+ welcomelabel.setBounds(10, 11, 1076, 45);
+ homeheaderpanel.add(welcomelabel);
+
+ JLabel lblHome = new JLabel("Home Page");
+ lblHome.setIcon(null);
+ lblHome.setForeground(Color.WHITE);
+ lblHome.setFont(new Font("Segoe UI", Font.BOLD, 29));
+ lblHome.setBounds(10, 97, 377, 45);
+ homeheaderpanel.add(lblHome);
+
+ lastloginlabel = new JLabel("Last Login : First Login");
+ lastloginlabel.setBackground(Color.WHITE);
+ lastloginlabel.setForeground(Color.WHITE);
+ lastloginlabel.setFont(new Font("Tahoma", Font.BOLD, 15));
+ lastloginlabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ lastloginlabel.setBounds(20, 47, 1066, 30);
+ homeheaderpanel.add(lastloginlabel);
+
+ timedifflabel = new JLabel("");
+ timedifflabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ timedifflabel.setForeground(Color.WHITE);
+ timedifflabel.setFont(new Font("Tahoma", Font.BOLD, 15));
+ timedifflabel.setBackground(Color.WHITE);
+ timedifflabel.setBounds(599, 75, 486, 19);
+ homeheaderpanel.add(timedifflabel);
+
+ }
+
+ public HomePanel(Admin a) {
+ this();
+ totalfaculitieslabel.setText(new FacultyData().getTotalFaculaty() + "");
+ totalstudentlabel.setText(new StudentData().getTotalStudents() + "");
+ totalcourcelabel.setText(new CourceData().getTotalCource() + "");
+ welcomelabel.setText("Welcome Adminstrator");
+ totallectureslabel.setText(new SubjectData().getTotalSubject() + "");
+ }
+
+ public HomePanel(Faculty f) {
+ this();
+ totalfaculitieslabel.setText(new FacultyData().getFaculaty(f.getCourceCode(), f.getSemorYear()) + "");
+ totalstudentlabel.setText(new StudentData().getTotalStudentInCource(f.getCourceCode(), f.getSemorYear()) + "");
+ totalnotificationlabel.setText(""+new NotificationData().getUnreadNotification(f.getFacultyId()+"", "Faculty", f.getCourceCode(), f.getSemorYear(),f.getJoinedDate()));
+ courcespanel.setVisible(false);
+ notificationpanel.setVisible(true);
+ welcomelabel.setText("Welcome " + f.getFacultyName());
+ totallectureslabel.setText(new SubjectData().getTotalSubjectinCource(f.getCourceCode(), f.getSemorYear()) + "");
+
+ studentspanel.setLocation(pos[0], studentspanel.getY());
+ faculitiespanel.setLocation(pos[1], faculitiespanel.getY());
+ subjectpanel.setLocation(pos[2], subjectpanel.getY());
+ notificationpanel.setLocation(pos[3], notificationpanel.getY());
+
+ }
+
+ public HomePanel(Student s) {
+ this();
+ totalfaculitieslabel.setText(new FacultyData().getFaculaty(s.getCourceCode(), s.getSemorYear()) + "");
+ totalstudentlabel.setText(new StudentData().getTotalStudentInCource(s.getCourceCode(), s.getSemorYear()) + "");
+
+ totalnotificationlabel.setText(""+new NotificationData().getUnreadNotification(s.getUserId()+"", "Student", s.getCourceCode(), s.getSemorYear(),s.getAdmissionDate()));
+ courcespanel.setVisible(false);
+ notificationpanel.setVisible(true);
+ welcomelabel.setText("Welcome " +s.getFullName());
+ totallectureslabel.setText(new SubjectData().getTotalSubjectinCource(s.getCourceCode(), s.getSemorYear()) + "");
+ studentspanel.setLocation(pos[0], studentspanel.getY());
+ faculitiespanel.setLocation(pos[1], faculitiespanel.getY());
+ subjectpanel.setLocation(pos[2], subjectpanel.getY());
+ notificationpanel.setLocation(pos[3], notificationpanel.getY());
+ }
+
+ public void setLastLogin(String lastlogin) {
+ if (lastlogin == null || lastlogin.isEmpty()) {
+ this.lastloginlabel.setText("last login : First Time");
+ } else {
+ this.lastloginlabel.setText("last login : " + lastlogin);
+// this.timedifflabel.setText(TimeUtil.getDateDifference(lastlogin));
+ }
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/src/collegeapplication/common/ImageUtil.java b/src/collegeapplication/common/ImageUtil.java
new file mode 100644
index 0000000..9788034
--- /dev/null
+++ b/src/collegeapplication/common/ImageUtil.java
@@ -0,0 +1,129 @@
+package collegeapplication.common;
+
+import java.awt.image.*;
+import java.awt.geom.RoundRectangle2D;
+import javax.swing.*;
+import java.awt.*;
+
+/*
+ * Title : ImageUtil.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : All the functions related to image like..
+ * ->Image to bufferedimage
+ * ->Resizing Bufferdimage
+ * ->Converting square shape image to round shape
+ * Mail : ajaysinhrathod1290@gmail.com
+ * Reference : https://stackoverflow.com/
+ */
+public class ImageUtil {
+
+ public static BufferedImage toBufferedImage(Image image)
+ {
+ if (image instanceof BufferedImage)
+ return (BufferedImage)image;
+
+ // This code ensures that all the pixels in the image are loaded
+ image = new ImageIcon(image).getImage();
+
+ // Determine if the image has transparent pixels
+ boolean hasAlpha = hasAlpha(image);
+
+ // Create a buffered image with a format that's compatible with the screen
+ BufferedImage bimage = null;
+
+ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+
+ try {
+ // Determine the type of transparency of the new buffered image
+ int transparency = Transparency.OPAQUE;
+
+ if (hasAlpha == true)
+ transparency = Transparency.BITMASK;
+
+ // Create the buffered image
+ GraphicsDevice gs = ge.getDefaultScreenDevice();
+ GraphicsConfiguration gc = gs.getDefaultConfiguration();
+
+ bimage = gc.createCompatibleImage(image.getWidth(null), image.getHeight(null), transparency);
+ } catch (HeadlessException e) { } //No screen
+
+ if (bimage == null) {
+ // Create a buffered image using the default color model
+ int type = BufferedImage.TYPE_INT_RGB;
+
+ if (hasAlpha == true) {type = BufferedImage.TYPE_INT_ARGB;}
+ bimage = new BufferedImage(image.getWidth(null), image.getHeight(null), type);
+ }
+
+ // Copy image to buffered image
+ Graphics g = bimage.createGraphics();
+
+ // Paint the image onto the buffered image
+ g.drawImage(image, 0, 0, null);
+ g.dispose();
+
+ return bimage;
+ }
+
+
+ public static boolean hasAlpha(Image image)
+ {
+ // If buffered image, the color model is readily available
+ if (image instanceof BufferedImage)
+ return ((BufferedImage)image).getColorModel().hasAlpha();
+
+ // Use a pixel grabber to retrieve the image's color model;
+ // grabbing a single pixel is usually sufficient
+ PixelGrabber pg = new PixelGrabber(image, 0, 0, 1, 1, false);
+ try {
+ pg.grabPixels();
+ } catch (InterruptedException e) { }
+
+ // Get the image's color model
+ return pg.getColorModel().hasAlpha();
+ }
+ public static BufferedImage resizeImage(final Image image, int width, int height) {
+
+ final BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
+ final Graphics2D graphics2D = bufferedImage.createGraphics();
+ graphics2D.setComposite(AlphaComposite.Src);
+ //below three lines are for RenderingHints for better image quality at cost of higher processing time
+ graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BILINEAR);
+ graphics2D.setRenderingHint(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY);
+ graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
+ graphics2D.drawImage(image, 0, 0, width, height, null);
+ graphics2D.dispose();
+ return bufferedImage;
+ }
+
+ public static BufferedImage makeRoundedCorner(BufferedImage image, int cornerRadius) {
+ int w = image.getWidth();
+ int h = image.getHeight();
+ BufferedImage output = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
+
+ Graphics2D g2 = output.createGraphics();
+ // This is what we want, but it only does hard-clipping, i.e. aliasing
+ // g2.setClip(new RoundRectangle2D ...)
+
+ // so instead fake soft-clipping by first drawing the desired clip shape
+ // in fully opaque white with antialiasing enabled...
+ g2.setComposite(AlphaComposite.Src);
+ g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ g2.setColor(Color.WHITE);
+ g2.fill(new RoundRectangle2D.Float(0, 0, w, h, cornerRadius, cornerRadius));
+
+ // ... then compositing the image on top,
+ // using the white shape from above as alpha source
+ g2.setComposite(AlphaComposite.SrcAtop);
+ g2.drawImage(image, 0, 0, null);
+
+ g2.dispose();
+
+ return output;
+ }
+
+}
+
+
+
+
\ No newline at end of file
diff --git a/src/collegeapplication/common/Notification.java b/src/collegeapplication/common/Notification.java
new file mode 100644
index 0000000..0b7bf74
--- /dev/null
+++ b/src/collegeapplication/common/Notification.java
@@ -0,0 +1,102 @@
+package collegeapplication.common;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import collegeapplication.cource.Cource;
+
+public class Notification extends Cource
+{
+
+ private String time;
+ private String title;
+ private String message;
+ private String readby;
+ private int sr_no;
+ private String userid;
+ private String userprofile;
+
+
+ public void setUserProfile(String userprofile)
+ {
+ this.userprofile=userprofile;
+ }
+ public void setSrNo(int sr_no)
+ {
+ this.sr_no=sr_no;
+ }
+ public void setUserId(String userid)
+ {
+ this.userid=userid;
+ }
+ public void setTime(String time)
+ {
+ this.time=time;
+ }
+ public void setTitle(String title)
+ {
+ this.title=title;
+ }
+ public void setMessage(String message)
+ {
+ this.message=message;
+ }
+ public void setReadBy(String readby)
+ {
+ this.readby=readby;
+ }
+ public int getSrNo()
+ {
+ return sr_no;
+ }
+ public String getUserId()
+ {
+ return userid;
+ }
+ public String getTitle()
+ {
+ return title;
+ }
+ public String getMessage()
+ {
+ return message;
+ }
+ public String getReadBy()
+ {
+ return readby;
+ }
+ public String getNotificationDate()
+ {
+ SimpleDateFormat dateformatter=new SimpleDateFormat("dd-MMM,yyyy");
+ SimpleDateFormat formater=new SimpleDateFormat("dd-MMM-yyyy hh:mm:ss aaa");
+ Date date=null;
+ try {
+ date = formater.parse(time);
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ return dateformatter.format(date);
+
+ }
+ public String getTime()
+ {
+ return time;
+ }
+ public String getNotificationTime()
+ {
+ SimpleDateFormat timeformatter=new SimpleDateFormat("hh:mm aaa");
+ SimpleDateFormat formater=new SimpleDateFormat("dd-MMM-yyyy hh:mm:ss aaa");
+ Date date=null;
+ try {
+ date = formater.parse(time);
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ return timeformatter.format(date);
+ }
+ public String getUserProfile()
+ {
+ return userprofile;
+ }
+}
diff --git a/src/collegeapplication/common/NotificationData.java b/src/collegeapplication/common/NotificationData.java
new file mode 100644
index 0000000..7fa89ad
--- /dev/null
+++ b/src/collegeapplication/common/NotificationData.java
@@ -0,0 +1,146 @@
+package collegeapplication.common;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.StringTokenizer;
+
+
+public class NotificationData {
+
+
+ Connection con=DataBaseConnection.getConnection();
+ public void addNotification(Notification n)
+ {
+ try
+ {
+ String query="insert into notification values(?,?,?,?,?,?,?,?,?)";
+ PreparedStatement pr=con.prepareStatement(query);
+ pr.setInt(1, 0);
+ pr.setString(2, n.getUserProfile());
+ pr.setString(3, n.getCourceCode());
+ pr.setString(5, n.getUserId());
+ pr.setInt(4, n.getSemorYear());
+ pr.setString(6,n.getTitle());
+ pr.setString(7, n.getMessage());
+ pr.setString(8, n.getTime());
+ pr.setString(9, "");
+ pr.executeUpdate();
+
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+
+ }
+
+ public ArrayList getNotifications(String courcecode,int semoryear,String userprofile,String joinedtime)
+ {
+ ArrayList list=new ArrayList();
+ try
+ {
+ String query="select * from notification where courcecode='"+courcecode+"' and semoryear="+semoryear+" and userprofile='"+userprofile+"' order by sr_no desc";
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ while(rs.next())
+ {
+ Notification n=new Notification();
+ n.setSrNo(rs.getInt(1));
+ n.setUserProfile(rs.getString(2));
+ n.setCourceCode(rs.getString(3));
+ n.setSemorYear(rs.getInt(4));
+ n.setUserId(rs.getString(5));
+ n.setTitle(rs.getString(6));
+ n.setMessage(rs.getString(7));
+ n.setTime(rs.getString(8));
+ n.setReadBy(rs.getString(9));
+ long diff=TimeUtil.getTimeDifference(joinedtime,n.getTime());
+ System.out.println("Diff between "+n.getTime()+"-"+joinedtime+":"+diff);
+ if(diff>0)
+ {
+ list.add(n);
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return list;
+ }
+ public void addReadBy(ArrayList list,String userid)
+ {
+ try
+ {
+ String query="update notification set readby=concat(readby,?,'#') where ";
+ query+=" sr_no="+list.get(0);
+ for(int i=1; i0)
+ {
+ total++;
+ }
+
+ }
+ }
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return total;
+ }
+ public boolean isReadBy(String str,String fromuserid)
+ {
+ if(str.isEmpty())
+ {
+ return false;
+ }
+
+ StringTokenizer readby=new StringTokenizer(str,"#");
+ while(readby.hasMoreTokens())
+ {
+ if(readby.nextToken().equals(fromuserid))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/src/collegeapplication/common/NotificationPanel.java b/src/collegeapplication/common/NotificationPanel.java
new file mode 100644
index 0000000..e731c0e
--- /dev/null
+++ b/src/collegeapplication/common/NotificationPanel.java
@@ -0,0 +1,353 @@
+package collegeapplication.common;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Image;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+import java.util.StringTokenizer;
+
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.SwingConstants;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.MatteBorder;
+
+import collegeapplication.admin.AdminData;
+import collegeapplication.faculty.Faculty;
+import collegeapplication.faculty.FacultyData;
+import collegeapplication.faculty.FacultyMain;
+import collegeapplication.faculty.ViewFacultyPanel;
+import collegeapplication.student.AttandanceReportPanel;
+import collegeapplication.student.MarkSheetPanel;
+import collegeapplication.student.Student;
+import collegeapplication.student.StudentData;
+import collegeapplication.student.StudentMain;
+import collegeapplication.student.StudentPanel;
+import collegeapplication.student.ViewStudentPanel;
+import collegeapplication.subject.SubjectPanel;
+
+@SuppressWarnings("serial")
+public class NotificationPanel extends JPanel {
+
+ /**
+ * Create the panel.
+ */
+ int row=200;
+ String date="";
+ ArrayList readbylist=new ArrayList();
+ String latest="";
+ private JPanel mainpanel;
+ private JScrollPane scrollPane;
+ private StudentMain sm;
+ private FacultyMain fm;
+
+ @Override
+ public Dimension getPreferredSize()
+ {
+ return getSize();
+ }
+ public NotificationPanel()
+ {
+ setBackground(new Color(255, 255, 255));
+ this.setSize(1116, 705);
+ setLayout(null);
+ setName("Notification Panel");
+ JLabel headinglabel = new JLabel(" Notification");
+ headinglabel.setIcon(null);
+ headinglabel.setBounds(10, 0, 1096, 188);
+ add(headinglabel);
+ headinglabel.setBackground(new Color(32, 178, 170));
+ headinglabel.setHorizontalAlignment(SwingConstants.LEFT);
+ headinglabel.setForeground(Color.WHITE);
+ headinglabel.setFont(new Font("Segoe UI", Font.BOLD, 30));
+ headinglabel.setOpaque(true);
+ mainpanel=new JPanel()
+ {
+ public Dimension getPreferredSize()
+ {
+ return new Dimension(286,row);
+ }
+ };
+ mainpanel.setSize(this.getWidth(), row);
+ mainpanel.setLayout(null);
+ mainpanel.setBackground(Color.white);
+
+ scrollPane=new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ scrollPane.setLocation(0, 188);
+ scrollPane.setSize(this.getWidth()-10,this.getHeight()-188);
+ scrollPane.setViewportView(mainpanel);
+ scrollPane.getVerticalScrollBar().setUnitIncrement(80);
+ for(Component c:scrollPane.getComponents())
+ {
+ c.setBackground(Color.white);
+ }
+ scrollPane.setBorder(new EmptyBorder(0,0,0,0));
+
+ add(scrollPane);
+ row=0;
+ }
+ public NotificationPanel(StudentMain sm)
+ {
+ this();
+ this.sm=sm;
+ addNotification(sm.s.getCourceCode(),sm.s.getSemorYear(),"Student",sm.s.getUserId(),sm.s.getAdmissionDate());
+ }
+ public NotificationPanel(FacultyMain fm)
+ {
+ this();
+ this.fm=fm;
+ addNotification(fm.f.getCourceCode(),fm.f.getSemorYear(),"Faculty",fm.f.getFacultyId()+"",fm.f.getJoinedDate());
+
+ }
+ public void addNotification(String courcecode,int semoryear,String userprofile,String userid,String joinedtime)
+ {
+ ArrayList list=new NotificationData().getNotifications(courcecode, semoryear,userprofile,joinedtime);
+ for(Notification n:list)
+ {
+
+ StringTokenizer readby=new StringTokenizer(n.getReadBy(),"#");
+ boolean contain=false;
+ if(n.getReadBy().isEmpty())
+ {
+ readbylist.add(n.getSrNo());
+ }
+ else
+ {
+
+ while(readby.hasMoreTokens())
+ {
+ if(readby.nextToken().equals(userid))
+ {
+ contain=true;
+ break;
+ }
+ }
+ if(!contain)
+ {
+ readbylist.add(n.getSrNo());
+ }
+ }
+ if(!contain&&!latest.equals("New"))
+ {
+ addLabel("New");
+ latest="New";
+ }
+ if(contain&&!latest.equals("Earlier"))
+ {
+ addLabel("Earlier");
+ latest="Earlier";
+ }
+ JPanel panel=createPanel(n);
+ mainpanel.add(panel);
+ row+=79;
+ }
+ if(readbylist.size()>0)
+ {
+ new NotificationData().addReadBy(readbylist, userid);
+ }
+
+ }
+ public void addLabel(String message)
+ {
+ JLabel label=new JLabel(message);
+ label.setBounds(10, row, this.getWidth()-20, 30);
+ label.setForeground(new Color(0,129,129));
+ label.setHorizontalAlignment(JLabel.LEFT);
+ label.setFont(new Font("Segoe UI",Font.PLAIN,20));
+ mainpanel.add(label);
+ row+=35;
+ }
+ public JPanel createPanel(Notification n)
+ {
+ JPanel panel=new JPanel();
+ panel.setBorder(new MatteBorder(1,0,1,0,Color.LIGHT_GRAY));
+ panel.setLayout(null);
+ panel.setBackground(Color.white);
+ panel.setBounds(this.getX()+10, row, this.getWidth()-40, 80);
+
+ JLabel titlelabel=new JLabel(n.getTitle());
+ titlelabel.setBounds(110,5,400,30);
+ titlelabel.setForeground(Color.DARK_GRAY);
+ titlelabel.setFont(new Font("Segoe UI",Font.BOLD,18));
+ panel.add(titlelabel);
+
+ JLabel timelabel=new JLabel(n.getTime());
+ timelabel.setBounds(410,10,panel.getWidth()-440,30);
+ timelabel.setHorizontalAlignment(JLabel.RIGHT);
+ timelabel.setForeground(new Color(0,139,139));
+ timelabel.setFont(new Font("Segoe UI",Font.PLAIN,15));
+ panel.add(timelabel);
+
+ JLabel profilepiclabel=new JLabel();
+ profilepiclabel.setBounds(10,2,80,75);
+ profilepiclabel.setHorizontalAlignment(JLabel.CENTER);
+ Image image=null;
+ if(n.getTitle().equals("New Student"))
+ {
+ image=new StudentData().getProfilePic(n.getUserId()).getScaledInstance(65, 65, Image.SCALE_SMOOTH);
+ }
+ else if(n.getTitle().equals("Subject Faculty"))
+ {
+ image=new FacultyData().getProfilePic(n.getUserId()).getScaledInstance(65, 65, Image.SCALE_SMOOTH);;
+ }
+ else
+ {
+ image=new AdminData().getProfilePic().getScaledInstance(65, 65, Image.SCALE_SMOOTH);;
+ }
+ image=ImageUtil.makeRoundedCorner(ImageUtil.toBufferedImage(image), 65);
+ profilepiclabel.setIcon(new ImageIcon(image));
+ panel.add(profilepiclabel);
+
+
+ JLabel messagelabel=new JLabel(n.getMessage());
+ messagelabel.setBounds(110,35,panel.getWidth()-10,30);
+ messagelabel.setForeground(Color.gray);
+ messagelabel.setFont(new Font("Segoe UI",Font.PLAIN,18));
+ panel.add(messagelabel);
+ panel.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ panel.setName(n.getTitle()+"#"+n.getUserId());
+ panel.addMouseListener(new MouseAdapter()
+ {
+ public void mouseEntered(MouseEvent e)
+ {
+ panel.setBackground(new Color(250,250,250));
+ }
+ public void mouseExited(MouseEvent e)
+ {
+ panel.setBackground(Color.white);
+ }
+ public void mousePressed(MouseEvent e)
+ {
+ if(e.getButton()==MouseEvent.BUTTON1&&e.getClickCount()>0)
+ {
+ StringTokenizer name=new StringTokenizer(panel.getName(),"#");
+ String title=name.nextToken();
+ String userid=name.nextToken();
+ if(title.equals("New Student"))
+ {
+ Student s=new StudentData().getStudentDetailsByUserId(userid);
+ if(sm!=null)
+ {
+
+ sm.viewstudentpanel=new ViewStudentPanel(s,sm,sm.notificationpanel);
+ sm.viewstudentpanel.setVisible(true);
+ sm.notificationpanel.setVisible(false);
+ sm.viewstudentpanel.setLocation(sm.panelx,0);
+ sm.viewstudentpanel.setVisible(true);
+ sm.viewstudentpanel.setFocusable(true);
+ sm.contentPane.add(sm.viewstudentpanel);
+ }
+ else if(fm!=null)
+ {
+ fm.viewstudentpanel=new ViewStudentPanel(s,fm,fm.notificationpanel);
+ fm.viewstudentpanel.setVisible(true);
+ fm.notificationpanel.setVisible(false);
+ fm.viewstudentpanel.setLocation(fm.panelx,0);
+ fm.viewstudentpanel.setVisible(true);
+ fm.viewstudentpanel.setFocusable(true);
+ fm.contentPane.add(fm.viewstudentpanel);
+ }
+ }
+ else if(title.equals("Subject Faculty"))
+ {
+ Faculty f=new FacultyData().getFacultyInfobyId(Integer.parseInt(userid));
+ if(sm!=null)
+ {
+ sm.viewfacultypanel=new ViewFacultyPanel(f,sm,sm.notificationpanel);
+ sm.viewfacultypanel.setVisible(true);
+ sm.notificationpanel.setVisible(false);
+ sm.viewfacultypanel.setLocation(sm.panelx,sm.panely);
+ sm.viewfacultypanel.setVisible(true);
+ sm.viewfacultypanel.setFocusable(true);
+ sm.contentPane.add(sm.viewfacultypanel);
+ }
+ else if(fm!=null)
+ {
+ fm.viewfacultypanel=new ViewFacultyPanel(f,fm,fm.notificationpanel);
+ fm.viewfacultypanel.setVisible(true);
+ fm.notificationpanel.setVisible(false);
+ fm.viewfacultypanel.setLocation(fm.panelx,fm.panely);
+ fm.viewfacultypanel.setVisible(true);
+ fm.viewfacultypanel.setFocusable(true);
+ fm.contentPane.add(fm.viewfacultypanel);
+ }
+ }
+ else if(title.equals("Result"))
+ {
+ if(sm!=null)
+ {
+ sm.notificationpanel.setVisible(false);
+ MarkSheetPanel marksheetpanel=new MarkSheetPanel(sm,sm.s,sm.notificationpanel);
+ marksheetpanel.setVisible(true);
+ sm.marksheetpanelscroll=new JScrollPane(marksheetpanel,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ sm.marksheetpanelscroll.getVerticalScrollBar().setUnitIncrement(16);
+ sm.marksheetpanelscroll.setBounds(sm.panelx,sm.panely, 1116, 705);
+ sm.contentPane.add(sm.marksheetpanelscroll);
+ sm.marksheetpanelscroll.setVisible(true);
+ }
+ else if(fm!=null)
+ {
+ fm.notificationpanel.setVisible(false);
+ fm.studentpanel=new StudentPanel(fm,fm.notificationpanel);
+ fm.studentpanel.setLocation(fm.panelx,fm.panely);
+ fm.studentpanel.setVisible(true);
+ fm.studentpanel.setFocusable(true);
+ fm.contentPane.add(fm.studentpanel);
+ }
+ }
+ else if(title.equals("Attandance"))
+ {
+ if(sm!=null)
+ {
+ sm.notificationpanel.setVisible(false);
+ sm.attandancereportpanel=new AttandanceReportPanel(sm,sm.notificationpanel);
+ sm.attandancereportpanel.setVisible(true);
+ sm.attandancereportpanelscroll=new JScrollPane(sm.attandancereportpanel,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ sm.attandancereportpanelscroll.setBounds(sm.panelx, sm.panely, 1116, 705);
+ sm.attandancereportpanelscroll.setVisible(true);
+ sm.attandancereportpanelscroll.setName("Attadance Report Panel Scroll");
+ sm.attandancereportpanelscroll.getVerticalScrollBar().setUnitIncrement(16);
+ sm.contentPane.add(sm.attandancereportpanelscroll);
+ for(Component c:sm.attandancereportpanelscroll.getComponents())
+ {
+ c.setBackground(Color.white);
+ }
+ }
+ }
+ else if(title.equals("New Subject"))
+ {
+ if(sm!=null)
+ {
+ sm.notificationpanel.setVisible(false);
+ sm.subjectpanel=new SubjectPanel(sm,sm.notificationpanel);
+ sm.subjectpanel.setLocation(sm.panelx, sm.panely);
+ sm.subjectpanel.setFocusable(true);
+ sm.contentPane.add(sm.subjectpanel);
+ sm.subjectpanel.setVisible(true);
+ }
+ else if(fm!=null)
+ {
+ fm.notificationpanel.setVisible(false);
+ fm.subjectpanel=new SubjectPanel(fm,fm.notificationpanel);
+ fm.subjectpanel.setLocation(fm.panelx, fm.panely);
+ fm.subjectpanel.setFocusable(true);
+ fm.contentPane.add(fm.subjectpanel);
+ fm.subjectpanel.setVisible(true);
+ }
+ }
+ }
+ }
+ }
+ );
+ return panel;
+ }
+
+
+}
diff --git a/src/collegeapplication/common/Person.java b/src/collegeapplication/common/Person.java
new file mode 100644
index 0000000..3927547
--- /dev/null
+++ b/src/collegeapplication/common/Person.java
@@ -0,0 +1,174 @@
+package collegeapplication.common;
+
+import java.awt.Image;
+import java.awt.Toolkit;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import javax.imageio.ImageIO;
+
+import collegeapplication.cource.Cource;
+import collegeapplication.cource.CourceData;
+
+public abstract class Person extends Cource{
+
+ private String emailid;
+ private String contactnumber;
+ private String birthdate;
+ private String gender;
+ private String state;
+ private String city;
+ private Image image;
+ private int sr_no;
+ private String lastlogin;
+ private String password;
+ private boolean isactive;
+
+
+
+ public void setEmailId(String emailid)
+ {
+ this.emailid=emailid;
+ }
+ public void setContactNumber(String contactnumber)
+ {
+ this.contactnumber=contactnumber;
+ }
+ public void setBirthDate(String birthdate)
+ {
+ this.birthdate=birthdate;
+ }
+ public void setGender(String gender)
+ {
+ this.gender=gender;
+ }
+ public void setState(String state)
+ {
+ this.state=state;
+ }
+ public void setCity(String city)
+ {
+ this.city=city;
+ }
+
+ public void setProfilePic(Image image)
+ {
+ this.image=image;
+ }
+ public void setProfilePic(byte[] imagedata)
+ {
+ this.image=Toolkit.getDefaultToolkit().createImage(imagedata);
+ }
+ public void setSrNo(int sr_no)
+ {
+ this.sr_no=sr_no;
+ }
+ public void setLastLogin(String lastlogin)
+ {
+ this.lastlogin=lastlogin;
+ }
+
+ public void setPassword(String password)
+ {
+ this.password=password;
+ }
+ public void setActiveStatus(boolean isactive)
+ {
+ this.isactive=isactive;
+ }
+
+ public String getCourceName()
+ {
+ return new CourceData().getcourcename(this.getCourceCode());
+ }
+
+ public String getEmailId()
+ {
+ return emailid;
+ }
+ public String getContactNumber()
+ {
+ return contactnumber;
+ }
+ public String getBirthDate()
+ {
+ return birthdate;
+ }
+ public Date getBirthDateInDateFormat()
+ {
+ Date date=null;
+ try {
+ date=new SimpleDateFormat("dd-MM-yyyy").parse(this.birthdate);
+ } catch (ParseException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return date;
+ }
+
+ public String getGender()
+ {
+ return gender;
+ }
+ public String getAddress()
+ {
+ return city+", "+state;
+ }
+ public String getPassword()
+ {
+ return password;
+ }
+ public String getState()
+ {
+ return state;
+ }
+ public String getCity()
+ {
+ return city;
+ }
+
+ public Image getProfilePic()
+ {
+ return image;
+ }
+ public byte[] getProfilePicInBytes()
+ {
+ ByteArrayOutputStream imagedata=new ByteArrayOutputStream();
+ try {
+ ImageIO.write(ImageUtil.toBufferedImage(image), "jpg", imagedata);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return imagedata.toByteArray();
+
+ }
+ public boolean comparePassword(String password)
+ {
+ return password.equals(this.password)?true:false;
+ }
+ public Image getProfilePic(int width,int height)
+ {
+ return image.getScaledInstance(width, height, Image.SCALE_SMOOTH);
+ }
+ public BufferedImage getRoundedProfilePic(int width,int height,int radius)
+ {
+ return ImageUtil.makeRoundedCorner(ImageUtil.toBufferedImage(image.getScaledInstance(width, height, Image.SCALE_SMOOTH)), radius);
+ }
+ public String getLastLogin()
+ {
+ return lastlogin;
+ }
+ public int getSrNo()
+ {
+ return sr_no;
+ }
+ public boolean getActiveStatus()
+ {
+ return isactive;
+ }
+}
diff --git a/src/collegeapplication/common/PhotoViewPanel.java b/src/collegeapplication/common/PhotoViewPanel.java
new file mode 100644
index 0000000..c345de6
--- /dev/null
+++ b/src/collegeapplication/common/PhotoViewPanel.java
@@ -0,0 +1,358 @@
+package collegeapplication.common;
+
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingConstants;
+import javax.swing.border.LineBorder;
+
+import collegeapplication.cource.CourceData;
+import collegeapplication.faculty.Faculty;
+import collegeapplication.faculty.FacultyData;
+import collegeapplication.faculty.FacultyPanel;
+import collegeapplication.faculty.ViewFacultyPanel;
+import collegeapplication.student.Student;
+import collegeapplication.student.StudentData;
+import collegeapplication.student.StudentPanel;
+import collegeapplication.student.ViewStudentPanel;
+
+
+/*
+ * Title : PhotoViewPanel.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : To displaying students and faculties image
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+@SuppressWarnings("serial")
+public class PhotoViewPanel extends JPanel {
+ int xpos[];
+ JPanel panel[][];
+ JLabel profilepiclabel[][];
+ JLabel namelabel[][];
+ JLabel degreelabel[][];
+ int totalfaculties=-1;
+ int totalstudents=-1;
+ int maxphotosinrow=3;
+ int incrementx=0;
+ int incrementy=0;
+ FacultyPanel fp;
+ StudentPanel sp;
+ /**
+ * Create the panel.
+ *
+ */
+
+ @Override
+ public Dimension getPreferredSize()
+ {
+ int n=0;
+ if(totalfaculties!=-1)
+ {
+ n=totalfaculties;
+ }
+ if(totalstudents!=-1)
+ {
+ n=totalstudents;
+ }
+ int row=n%maxphotosinrow==0?n/maxphotosinrow:(n/maxphotosinrow)+1;
+ if(row==1)
+ {
+ return new Dimension(xpos[maxphotosinrow-1]+xpos[1]-xpos[0],incrementy+20);
+ }
+
+ return new Dimension( 1116,row*(incrementy));
+ }
+ public PhotoViewPanel(FacultyPanel facultyPanel,int maxphoto) {
+
+ this.maxphotosinrow=maxphoto;
+ this.setFocusable(true);
+ this.fp=facultyPanel;
+ xpos=new int[maxphotosinrow];
+ incrementx=(4*270)/maxphotosinrow;
+ int start=20;
+
+ for(int i=0; itotalfaculties)
+ {
+ break;
+ }
+ }
+ column+=incrementy;
+ }
+
+ }
+ public PhotoViewPanel(StudentPanel sp,int maxphoto)
+ {
+ this.maxphotosinrow=maxphoto;
+ this.sp=sp;
+ xpos=new int[maxphotosinrow];
+ incrementx=(4*270)/maxphotosinrow;
+ int start=20;
+
+ for(int i=0; itotalstudents)
+ {
+ break;
+ }
+ }
+ column+=incrementy;
+ }
+
+
+ }
+ public int changeNameFont()
+ {
+ return maxphotosinrow<4?22:maxphotosinrow<8?17:maxphotosinrow<12?13:10;
+ }
+ public int changeDegreeFont()
+ {
+ return maxphotosinrow<4?18:maxphotosinrow<8?14:maxphotosinrow<12?13:10;
+ }
+
+
+
+
+}
diff --git a/src/collegeapplication/common/PrintMarksheetDialog.java b/src/collegeapplication/common/PrintMarksheetDialog.java
new file mode 100644
index 0000000..a105560
--- /dev/null
+++ b/src/collegeapplication/common/PrintMarksheetDialog.java
@@ -0,0 +1,379 @@
+package collegeapplication.common;
+
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Dialog;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.image.BufferedImage;
+import java.awt.print.PageFormat;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+import java.io.File;
+import java.io.IOException;
+
+import javax.imageio.ImageIO;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingConstants;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.LineBorder;
+
+import collegeapplication.admin.AdminMain;
+import collegeapplication.faculty.FacultyMain;
+import collegeapplication.student.Student;
+import collegeapplication.student.StudentMain;
+
+
+/*
+ * Title : PrintPageDialog.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : To download student marksheet in selected format
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+@SuppressWarnings("serial")
+public class PrintMarksheetDialog extends JDialog {
+
+ private static PrintMarksheetDialog dialog;
+ private final JPanel contentPanel = new JPanel();
+ private AdminMain am;
+ private String filename;
+ private BufferedImage image;
+ private JLabel filedownloadedlabel;
+ public printMarksheetPDF p;
+ private FacultyMain fm;
+ private StudentMain sm;
+ private JLabel imagelabel;
+ private JLabel filepathlabel;
+ private JButton btnPdf;
+ /**
+ * Launch the application.
+ */
+ public static void main(String[] args) {
+ try {
+ dialog = new PrintMarksheetDialog(null);
+ dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+ dialog.setVisible(true);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**+
+ * Create the dialog.
+ */
+ public PrintMarksheetDialog(AdminMain am,Student s)
+ {
+ this(s);
+ this.am=am;
+
+ image=new BufferedImage(am.marksheetpanel.getWidth(),am.marksheetpanel.getHeight(),BufferedImage.TYPE_INT_ARGB);
+ am.marksheetpanel.disablebutton();
+ am.marksheetpanel.print(image.getGraphics());
+ am.marksheetpanel.enablebutton();
+ BufferedImage imageicon=ImageUtil.resizeImage(image, imagelabel.getWidth()+20, imagelabel.getHeight()-20);
+ imagelabel.setIcon(new ImageIcon(imageicon));
+ p=new printMarksheetPDF(am);
+ p.setPdfTitle(s.getUserId()+" Marksheet");
+ p.setPath(filepathlabel.getText()+"\\"+filename+".pdf");
+ p.disposeDialog(this);
+ btnPdf.addActionListener(p);
+ }
+ public PrintMarksheetDialog(FacultyMain fm,Student s)
+ {
+ this(s);
+ this.fm=fm;
+
+ image=new BufferedImage(fm.marksheetpanel.getWidth(),fm.marksheetpanel.getHeight(),BufferedImage.TYPE_INT_ARGB);
+ fm.marksheetpanel.disablebutton();
+ fm.marksheetpanel.print(image.getGraphics());
+ fm.marksheetpanel.enablebutton();
+ BufferedImage imageicon=ImageUtil.resizeImage(image, imagelabel.getWidth()+20, imagelabel.getHeight()-20);
+ imagelabel.setIcon(new ImageIcon(imageicon));
+ p=new printMarksheetPDF(fm);
+ p.setPdfTitle(s.getUserId()+" Marksheet");
+ p.setPath(filepathlabel.getText()+"\\"+filename+".pdf");
+ p.disposeDialog(this);
+ btnPdf.addActionListener(p);
+ }
+ public PrintMarksheetDialog(StudentMain sm,Student s)
+ {
+ this(s);
+ this.sm=sm;
+
+ image=new BufferedImage(sm.marksheetpanel.getWidth(),sm.marksheetpanel.getHeight(),BufferedImage.TYPE_INT_ARGB);
+ sm.marksheetpanel.downloadbutton.setVisible(false);
+ sm.marksheetpanel.print(image.getGraphics());
+ sm.marksheetpanel.downloadbutton.setVisible(true);
+ BufferedImage imageicon=ImageUtil.resizeImage(image, imagelabel.getWidth()+20, imagelabel.getHeight()-20);
+ imagelabel.setIcon(new ImageIcon(imageicon));
+ p=new printMarksheetPDF(sm);
+ p.setPdfTitle(s.getUserId()+" Marksheet");
+ p.setPath(filepathlabel.getText()+"\\"+filename+".pdf");
+ p.disposeDialog(this);
+ btnPdf.addActionListener(p);
+ }
+ private PrintMarksheetDialog(Student s) {
+ super(dialog,null,Dialog.ModalityType.APPLICATION_MODAL);
+
+ getContentPane().setBackground(new Color(255, 255, 255));
+ setBackground(new Color(220, 220, 220));
+ setResizable(false);
+ setTitle("Print Marksheet");
+ setBounds(100, 100, 516, 294);
+ getContentPane().setLayout(null);
+ contentPanel.setBorder(new EmptyBorder(0, 0, 0, 0));
+ contentPanel.setBackground(new Color(255, 255, 255));
+ contentPanel.setBounds(0, 55, 510, 210);
+ getContentPane().add(contentPanel);
+ contentPanel.setLayout(null);
+
+ imagelabel = new JLabel("image");
+ imagelabel.setBounds(10, 11, 124, 126);
+
+ imagelabel.setOpaque(true);
+ imagelabel.setBackground(new Color(255, 255, 255));
+ imagelabel.setHorizontalAlignment(SwingConstants.CENTER);
+ imagelabel.setBorder(new LineBorder(Color.LIGHT_GRAY));
+
+ contentPanel.add(imagelabel);
+ String home = System.getProperty("user.home");
+ filepathlabel = new JLabel(home+"\\Downloads\\");
+ filepathlabel.setForeground(new Color(0, 0, 0));
+ filepathlabel.setFont(new Font("Tahoma", Font.PLAIN, 13));
+ filepathlabel.setBounds(144, 37, 346, 26);
+ contentPanel.add(filepathlabel);
+
+ JLabel filenamelabel = new JLabel();
+ filename=s.getCourceCode()+"-"+s.getSemorYear()+"-"+s.getRollNumber()+"-"+s.getFullName()+"-"+"mark-sheet";
+ filenamelabel.setText(filename);
+ filenamelabel.setForeground(Color.BLACK);
+ filenamelabel.setFont(new Font("Tahoma", Font.PLAIN, 13));
+ filenamelabel.setBounds(144, 80, 346, 33);
+ contentPanel.add(filenamelabel);
+
+ JButton btnPng = new JButton("PNG");
+ btnPng.setIcon(new ImageIcon(".\\assets\\pngbutton.png"));
+ btnPng.setFocusable(false);
+ beforebutton(btnPng);
+ btnPng.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ // TODO Auto-generated method stub
+ try {
+ ImageIO.write(image, "png", new File(filepathlabel.getText()+"\\"+filename+".png"));
+ afterbutton(btnPng);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ }
+ );
+ btnPng.setFont(new Font("Segoe UI", Font.BOLD, 13));
+ btnPng.setBounds(10, 163, 116, 33);
+ contentPanel.add(btnPng);
+
+ JButton btnJpg = new JButton("JPG");
+ btnJpg.setIcon(new ImageIcon(".\\assets\\jpgbutton.png"));
+ btnJpg.setFont(new Font("Segoe UI", Font.BOLD, 13));
+ btnJpg.setFocusable(false);
+ beforebutton(btnJpg);
+ btnJpg.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ // TODO Auto-generated method stub
+ try
+ {
+ BufferedImage good_image=new BufferedImage(image.getWidth(),image.getHeight(),BufferedImage.TYPE_INT_RGB);
+ Graphics2D B2G=good_image.createGraphics();
+ B2G.drawImage(image,0,0,null);
+ B2G.dispose();
+ ImageIO.write(good_image, "jpeg", new File(filepathlabel.getText()+"\\"+filename+".jpeg"));
+ afterbutton(btnJpg);
+ }
+ catch (IOException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ }
+ );
+
+ btnJpg.setBounds(136, 163, 115, 33);
+ contentPanel.add(btnJpg);
+
+ btnPdf = new JButton("PDF");
+ btnPdf.setIcon(new ImageIcon(".\\assets\\pdfbutton.png"));
+ btnPdf.setFont(new Font("Segoe UI", Font.BOLD, 13));
+ btnPdf.setFocusable(false);
+ beforebutton(btnPdf);
+ btnPdf.setBounds(261, 163, 115, 33);
+ contentPanel.add(btnPdf);
+
+ JButton btnPrint = new JButton("Print");
+ btnPrint.setIcon(new ImageIcon(".\\assets\\printbutton.png"));
+ btnPrint.setFont(new Font("Segoe UI", Font.BOLD, 13));
+ btnPrint.setFocusable(false);
+ btnPrint.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+
+ // TODO Auto-generated method stub
+ PrinterJob job=PrinterJob.getPrinterJob();
+ job.setJobName(s.getUserId()+" Marksheet");
+ job.setPrintable(new Printable()
+ {
+
+ @Override
+ public int print(Graphics pg, PageFormat pf, int pagenum) throws PrinterException
+ {
+ // TODO Auto-generated method stub
+ pf.setOrientation(PageFormat.LANDSCAPE);
+ if(pagenum>0)
+ {
+ return Printable.NO_SUCH_PAGE;
+ }
+ Graphics2D g=(Graphics2D) pg;
+ g.translate(pf.getImageableX(), pf.getImageableY());
+ g.scale(0.543,0.60);
+
+ if(am!=null)
+ {
+ am.marksheetpanel.print(g);
+ }
+ else if(fm!=null)
+ {
+ fm.marksheetpanel.print(g);
+ }
+ else if(sm!=null)
+ {
+ sm.marksheetpanel.print(g);
+ }
+ return Printable.PAGE_EXISTS;
+ }
+
+ });
+
+ if (job.printDialog() == false)
+ return;
+
+ try {
+ if(am!=null)
+ {
+ am.marksheetpanel.disablebutton();
+ }
+ else if(fm!=null)
+ {
+ fm.marksheetpanel.disablebutton();
+ }
+ else if(sm!=null)
+ {
+ sm.marksheetpanel.downloadbutton.setVisible(false);
+ }
+ job.print();
+ afterbutton(btnPrint);
+ if(am!=null)
+ {
+ am.marksheetpanel.enablebutton();
+ }
+ else if(fm!=null)
+ {
+ fm.marksheetpanel.enablebutton();
+ }
+ else if(sm!=null)
+ {
+ sm.marksheetpanel.downloadbutton.setVisible(true);
+ }
+ } catch (PrinterException ex) {
+ // handle exception
+ }
+
+ }
+
+ });
+ beforebutton(btnPrint);
+ btnPrint.setBounds(386, 163, 114, 33);
+ contentPanel.add(btnPrint);
+
+ JLabel lblFilePath = new JLabel("File Path :");
+ lblFilePath.setForeground(Color.BLACK);
+ lblFilePath.setFont(new Font("Tahoma", Font.PLAIN, 13));
+ lblFilePath.setBounds(144, 11, 346, 26);
+ contentPanel.add(lblFilePath);
+
+ JLabel lblFileName = new JLabel("File Name :");
+ lblFileName.setForeground(Color.BLACK);
+ lblFileName.setFont(new Font("Tahoma", Font.PLAIN, 13));
+ lblFileName.setBounds(144, 60, 346, 26);
+ contentPanel.add(lblFileName);
+
+ filedownloadedlabel = new JLabel();
+ filedownloadedlabel.setIcon(new ImageIcon(".\\assets\\downloadedbutton.png"));
+ filedownloadedlabel.setText("Png Flie Downloaded Succesfully");
+ filedownloadedlabel.setForeground(new Color(46, 139, 87));
+ filedownloadedlabel.setFont(new Font("Segoe UI", Font.BOLD, 13));
+ filedownloadedlabel.setVisible(false);
+ filedownloadedlabel.setBounds(144, 111, 366, 33);
+ contentPanel.add(filedownloadedlabel);
+
+ JPanel panel = new JPanel();
+ panel.setBackground(new Color(32, 178, 170));
+ panel.setBounds(0, 2, 510, 47);
+ getContentPane().add(panel);
+ panel.setLayout(null);
+
+ JLabel lblPrintMarksheet = new JLabel("Print Marksheet");
+ lblPrintMarksheet.setBounds(76, 11, 358, 25);
+ panel.add(lblPrintMarksheet);
+ lblPrintMarksheet.setForeground(new Color(255, 255, 255));
+ lblPrintMarksheet.setBackground(new Color(32, 178, 170));
+ lblPrintMarksheet.setFont(new Font("Segoe UI", Font.BOLD, 22));
+ lblPrintMarksheet.setHorizontalAlignment(SwingConstants.CENTER);
+ }
+ public void dispose()
+ {
+ this.dispose();
+ }
+ public void beforebutton(JButton button)
+ {
+ button.setForeground(new Color(255, 255, 255));
+ button.setFocusable(false);
+ button.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ button.setBorder(new EmptyBorder(0, 0, 0, 0));
+ button.setBackground(new Color(32,178,170));
+ button.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ }
+ public void afterbutton(JButton button)
+ {
+ filedownloadedlabel.setVisible(true);
+ if(button.getText().contains("Print"))
+ {
+ filedownloadedlabel.setText(" File Printed Successfully");
+ }
+ else
+ {
+ filedownloadedlabel.setText(button.getText()+" File Downloaded Successfully");
+ }
+ }
+
+}
diff --git a/src/collegeapplication/common/ScrollPaneUtil.java b/src/collegeapplication/common/ScrollPaneUtil.java
new file mode 100644
index 0000000..6d4d86e
--- /dev/null
+++ b/src/collegeapplication/common/ScrollPaneUtil.java
@@ -0,0 +1,37 @@
+package collegeapplication.common;
+
+import java.awt.Adjustable;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+
+import javax.swing.JScrollBar;
+import javax.swing.JScrollPane;
+
+
+/*
+ * Title : ScrollPaneUtil.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : To set scroll bar at bottom
+ * Reference : https://stackoverflow.com/
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+
+public class ScrollPaneUtil {
+
+ public static void scrollToBottom(JScrollPane scrollPane)
+ {
+ JScrollBar verticalBar = scrollPane.getVerticalScrollBar();
+ AdjustmentListener downScroller = new AdjustmentListener()
+ {
+ @Override
+ public void adjustmentValueChanged(AdjustmentEvent e)
+ {
+ Adjustable adjustable = e.getAdjustable();
+ adjustable.setValue(adjustable.getMaximum());
+ verticalBar.removeAdjustmentListener(this);
+ }
+ };
+ verticalBar.addAdjustmentListener(downScroller);
+ }
+}
diff --git a/src/collegeapplication/common/SearchPanel.java b/src/collegeapplication/common/SearchPanel.java
new file mode 100644
index 0000000..87b4520
--- /dev/null
+++ b/src/collegeapplication/common/SearchPanel.java
@@ -0,0 +1,470 @@
+package collegeapplication.common;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.SwingConstants;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.LineBorder;
+import javax.swing.table.DefaultTableCellRenderer;
+
+import collegeapplication.admin.AdminMain;
+import collegeapplication.cource.CourceData;
+import collegeapplication.faculty.Faculty;
+import collegeapplication.faculty.FacultyData;
+import collegeapplication.faculty.FacultyMain;
+import collegeapplication.faculty.ViewFacultyPanel;
+import collegeapplication.student.Student;
+import collegeapplication.student.StudentData;
+import collegeapplication.student.StudentMain;
+import collegeapplication.student.ViewStudentPanel;
+import net.proteanit.sql.DbUtils;
+
+
+/*
+ * Title : SearchPanel.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : For searching student of faculty
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+
+@SuppressWarnings("serial")
+public class SearchPanel extends JPanel implements ActionListener {
+
+ private JTable table;
+ private JScrollPane tableviewscroll;
+ private JTextField searchfield;
+ private JComboBox courcenamecombo;
+ private JComboBox semoryearcombo;
+ private JComboBox studentandfacultycombo;
+
+ private JButton searchbutton;
+ /**
+ * Create the panel.
+ */
+ public SearchPanel(AdminMain am)
+ {
+ this();
+ table.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ if(e.getClickCount()>1 && e.getButton()==MouseEvent.BUTTON1)
+ {
+ if(studentandfacultycombo.getSelectedIndex()==0)
+ {
+ JTable t=(JTable) e.getSource();
+ int row=t.getSelectedRow();
+ String courcecode=table.getValueAt(row,0)+"";
+ String strsem=table.getValueAt(row, 4)+"";
+ int sem=Integer.parseInt(strsem.substring(strsem.indexOf('-')+1));
+ String strroll=table.getValueAt(row, 1)+"";
+ long rollnumber=Long.parseLong(strroll);
+ Student s=new StudentData().getStudentDetails(courcecode,sem,rollnumber);
+
+ am.viewstudentpanel=new ViewStudentPanel(s,am,am.searchpanel);
+ am.viewstudentpanel.setVisible(true);
+ am.searchpanel.setVisible(false);
+ am.viewstudentpanel.setLocation(am.panelx,0);
+ am.viewstudentpanel.setVisible(true);
+ am.viewstudentpanel.setFocusable(true);
+ am.contentPane.add(am.viewstudentpanel);
+ }
+ else
+ {
+ JTable t=(JTable) e.getSource();
+ int fid=Integer.parseInt(t.getValueAt(t.getSelectedRow(), 0)+"");
+ Faculty f=new FacultyData().getFacultyInfobyId(fid);
+
+ am.viewfacultypanel=new ViewFacultyPanel(f,am,am.searchpanel);
+ am.viewfacultypanel.setVisible(true);
+ am.searchpanel.setVisible(false);
+ am.viewfacultypanel.setLocation(am.panelx,am.panely);
+ am.viewfacultypanel.setVisible(true);
+ am.viewfacultypanel.setFocusable(true);
+ am.contentPane.add(am.viewfacultypanel);
+ }
+ }
+ }
+ });
+
+
+ }
+ public SearchPanel(FacultyMain fm)
+ {
+ this();
+ courcenamecombo.setSelectedItem(new CourceData().getcourcename(fm.f.getCourceCode()));
+ courcenamecombo.setEnabled(false);
+ courcenamecombo.setRenderer(new DefaultListCellRenderer() {
+ @Override
+ public void paint(Graphics g) {
+ setForeground(Color.BLACK);
+ setBackground(Color.WHITE);
+ super.paint(g);
+ }
+ });
+ semoryearcombo.setSelectedIndex(fm.f.getSemorYear());
+ semoryearcombo.setEnabled(false);
+ semoryearcombo.setRenderer(new DefaultListCellRenderer() {
+ @Override
+ public void paint(Graphics g) {
+ setForeground(Color.BLACK);
+ setBackground(Color.WHITE);
+ super.paint(g);
+ }
+ });
+ this.createtablemodel();
+ table.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ if(e.getClickCount()>1 && e.getButton()==MouseEvent.BUTTON1)
+ {
+ if(studentandfacultycombo.getSelectedIndex()==0)
+ {
+ JTable t=(JTable) e.getSource();
+ int row=t.getSelectedRow();
+ String courcecode=table.getValueAt(row,0)+"";
+ String strsem=table.getValueAt(row, 4)+"";
+ int sem=Integer.parseInt(strsem.substring(strsem.indexOf('-')+1));
+ String strroll=table.getValueAt(row, 1)+"";
+ long rollnumber=Long.parseLong(strroll);
+ Student s=new StudentData().getStudentDetails(courcecode,sem,rollnumber);
+
+ fm.viewstudentpanel=new ViewStudentPanel(s,fm,fm.searchpanel);
+ fm.viewstudentpanel.setVisible(true);
+ fm.searchpanel.setVisible(false);
+ fm.viewstudentpanel.setLocation(fm.panelx,0);
+ fm.viewstudentpanel.setVisible(true);
+ fm.viewstudentpanel.setFocusable(true);
+ fm.contentPane.add(fm.viewstudentpanel);
+ }
+ else
+ {
+ JTable t=(JTable) e.getSource();
+ int fid=Integer.parseInt(t.getValueAt(t.getSelectedRow(), 0)+"");
+ Faculty f=new FacultyData().getFacultyInfobyId(fid);
+
+ fm.viewfacultypanel=new ViewFacultyPanel(f,fm,fm.searchpanel);
+ fm.viewfacultypanel.setVisible(true);
+ fm.searchpanel.setVisible(false);
+ fm.viewfacultypanel.setLocation(fm.panelx,fm.panely);
+ fm.viewfacultypanel.setVisible(true);
+ fm.viewfacultypanel.setFocusable(true);
+ fm.contentPane.add(fm.viewfacultypanel);
+ }
+ }
+ }
+ });
+
+ }
+ public SearchPanel(StudentMain sm)
+ {
+ this();
+ courcenamecombo.setSelectedItem(new CourceData().getcourcename(sm.s.getCourceCode()));
+ courcenamecombo.setEnabled(false);
+ courcenamecombo.setRenderer(new DefaultListCellRenderer() {
+ @Override
+ public void paint(Graphics g) {
+ setForeground(Color.BLACK);
+ setBackground(Color.WHITE);
+ super.paint(g);
+ }
+ });
+ semoryearcombo.setSelectedIndex(sm.s.getSemorYear());
+ semoryearcombo.setEnabled(false);
+ semoryearcombo.setRenderer(new DefaultListCellRenderer() {
+ @Override
+ public void paint(Graphics g) {
+ setForeground(Color.BLACK);
+ setBackground(Color.WHITE);
+ super.paint(g);
+ }
+ });
+ this.createtablemodel();
+ table.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ if(e.getClickCount()>1 && e.getButton()==MouseEvent.BUTTON1)
+ {
+ if(studentandfacultycombo.getSelectedIndex()==0)
+ {
+ JTable t=(JTable) e.getSource();
+ int row=t.getSelectedRow();
+ String courcecode=table.getValueAt(row,0)+"";
+ String strsem=table.getValueAt(row, 4)+"";
+ int sem=Integer.parseInt(strsem.substring(strsem.indexOf('-')+1));
+ String strroll=table.getValueAt(row, 1)+"";
+ long rollnumber=Long.parseLong(strroll);
+ Student s=new StudentData().getStudentDetails(courcecode,sem,rollnumber);
+
+ sm.viewstudentpanel=new ViewStudentPanel(s,sm,sm.searchpanel);
+ sm.viewstudentpanel.setVisible(true);
+ sm.searchpanel.setVisible(false);
+ sm.viewstudentpanel.setLocation(sm.panelx,0);
+ sm.viewstudentpanel.setVisible(true);
+ sm.viewstudentpanel.setFocusable(true);
+ sm.contentPane.add(sm.viewstudentpanel);
+ }
+ else
+ {
+ JTable t=(JTable) e.getSource();
+ int fid=Integer.parseInt(t.getValueAt(t.getSelectedRow(), 0)+"");
+ Faculty f=new FacultyData().getFacultyInfobyId(fid);
+
+ sm.viewfacultypanel=new ViewFacultyPanel(f,sm,sm.searchpanel);
+ sm.viewfacultypanel.setVisible(true);
+ sm.searchpanel.setVisible(false);
+ sm.viewfacultypanel.setLocation(sm.panelx,sm.panely);
+ sm.viewfacultypanel.setVisible(true);
+ sm.viewfacultypanel.setFocusable(true);
+ sm.contentPane.add(sm.viewfacultypanel);
+ }
+ }
+ }
+ });
+
+ }
+ public SearchPanel() {
+ this.setName("Search Panel");
+ setBackground(new Color(255, 255, 255));
+ this.setSize(1116, 705);
+ setLayout(null);
+
+ tableviewscroll = new JScrollPane();
+ tableviewscroll.setBorder(new EmptyBorder(0, 0, 0, 0));
+ tableviewscroll.setBounds(10, 194, 1096, 500);
+ for(Component c : tableviewscroll.getComponents())
+ {
+ c.setBackground(Color.white);
+ }
+ add(tableviewscroll);
+
+
+
+ table = new JTable();
+
+ table.setBorder(new LineBorder(Color.LIGHT_GRAY));
+
+
+ table.getTableHeader().setBackground(new Color(32,178,170));
+ table.getTableHeader().setForeground(Color.white);
+ table.setSelectionBackground(new Color(240, 255, 255));
+ table.getTableHeader().setFont(new Font("Arial",Font.BOLD,20));
+ table.setFont(new Font("Segoe UI",Font.PLAIN,20));
+ table.setModel(DbUtils.resultSetToTableModel(new StudentData().getStudentinfo("")));
+ table.getTableHeader().setPreferredSize(new Dimension(50,40));
+ table.setFocusable(false);
+ table.setDragEnabled(false);
+ table.setRowHeight(40);
+ table.setDefaultEditor(Object.class, null);
+ table.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ table.setGridColor(Color.LIGHT_GRAY);
+ table.getTableHeader().setReorderingAllowed(false);
+ tableviewscroll.setViewportView(table);
+
+
+ JPanel panel = new JPanel();
+ panel.setBackground(new Color(32, 178, 170));
+ panel.setBounds(10, 0, 1096, 183);
+ add(panel);
+ panel.setLayout(null);
+ JLabel lblStudentManagement = new JLabel("Search");
+ lblStudentManagement.setIcon(null);
+ lblStudentManagement.setBounds(10, 38, 224, 44);
+ panel.add(lblStudentManagement);
+ lblStudentManagement.setBackground(new Color(32, 178, 170));
+ lblStudentManagement.setHorizontalAlignment(SwingConstants.LEFT);
+ lblStudentManagement.setForeground(Color.WHITE);
+ lblStudentManagement.setFont(new Font("Segoe UI", Font.BOLD, 30));
+ lblStudentManagement.setOpaque(true);
+
+ studentandfacultycombo = new JComboBox();
+ studentandfacultycombo.setModel(new DefaultComboBoxModel(new String[] {"Students", "Faculties"}));
+ this.arrangeStudentTable();
+ studentandfacultycombo.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ studentandfacultycombo.setBounds(10, 128, 205, 40);
+ studentandfacultycombo.addActionListener(this);
+ panel.add(studentandfacultycombo);
+
+ String courcename[]=new CourceData().getCourceName();
+ courcename[0]="All Cources";
+ courcenamecombo = new JComboBox(courcename);
+
+ courcenamecombo.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ courcenamecombo.setBounds(225, 128, 255, 40);
+ courcenamecombo.addActionListener(this);
+
+ panel.add(courcenamecombo);
+
+ semoryearcombo = new JComboBox();
+ semoryearcombo.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ semoryearcombo.setBounds(490, 128, 214, 40);
+ semoryearcombo.addActionListener(this);
+ panel.add(semoryearcombo);
+
+ searchfield = new HintTextField("Search");
+ searchfield.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ searchfield.setForeground(Color.DARK_GRAY);
+ searchfield.setBounds(714, 129, 248, 40);
+ panel.add(searchfield);
+ searchfield.setColumns(10);
+
+ searchbutton = new JButton();
+ searchbutton.setForeground(new Color(0, 139, 139));
+ searchbutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ searchbutton.setText("Search");
+ searchbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ searchbutton.setBackground(new Color(255, 255, 255));
+ searchbutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ searchbutton.setIcon(new ImageIcon("./assets/search.png"));
+ searchbutton.setBounds(972, 129, 114, 40);
+ searchbutton.addActionListener(this);
+ searchbutton.setFocusable(false);
+ panel.add(searchbutton);
+
+
+ }
+
+
+ public void arrangeStudentTable()
+ {
+ table.getColumnModel().getColumn(0).setMaxWidth(150);
+ table.getColumnModel().getColumn(1).setMaxWidth(200);
+ table.getColumnModel().getColumn(2).setMaxWidth(300);
+ table.getColumnModel().getColumn(3).setMaxWidth(300);
+ table.getColumnModel().getColumn(4).setMaxWidth(150);
+ table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
+ }
+ public void arrangeFacultyTable()
+ {
+ table.getColumnModel().getColumn(0).setMaxWidth(200);
+ table.getColumnModel().getColumn(1).setMaxWidth(300);
+ table.getColumnModel().getColumn(2).setMaxWidth(500);
+ table.getColumnModel().getColumn(3).setMaxWidth(250);
+ table.getColumnModel().getColumn(4).setMaxWidth(250);
+ table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
+ DefaultTableCellRenderer cellrenderer=new DefaultTableCellRenderer();
+ cellrenderer.setHorizontalAlignment(JLabel.CENTER);
+ table.getColumnModel().getColumn(0).setCellRenderer(cellrenderer);
+ }
+
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ // TODO Auto-generated method stub
+
+
+
+ if(e.getSource()==courcenamecombo)
+ {
+
+
+ if(courcenamecombo.getSelectedIndex()==0)
+ {
+ semoryearcombo.setModel(new DefaultComboBoxModel(new String[] {""}));
+
+ }
+
+ else
+ {
+ String cource=(String) courcenamecombo.getSelectedItem();
+ String semoryear[]=new CourceData().getSemorYear(cource);
+ semoryear[0]="All "+semoryear[1].substring(0,semoryear[1].indexOf(' '));
+ semoryearcombo.setModel(new DefaultComboBoxModel(semoryear));
+ }
+
+ }
+ if(e.getSource()==searchbutton)
+ {
+
+ createtablemodel();
+ }
+
+ }
+ public void createtablemodel()
+ {
+ String searchtext=searchfield.getText().trim();
+ if(studentandfacultycombo.getSelectedIndex()==0)
+ {
+ String defaultquery="select s.courcecode as 'Class' ,s.rollnumber as 'Roll Number',concat(s.firstname,' ',s.lastname) as 'Student Name',c.courcename as 'Cource Name',concat(c.semoryear,'-',s.semoryear) as 'Sem/Year' from students s left join cources c on s.courcecode=c.courcecode ";
+ String query=defaultquery;
+ if(courcenamecombo.getSelectedIndex()>0)
+ {
+ String courcecode=new CourceData().getCourcecode(courcenamecombo.getSelectedItem()+"");
+ query+=" where s.courcecode='"+courcecode+"'";
+ if(semoryearcombo.getSelectedIndex()>0)
+ {
+ query+=" and s.semoryear="+semoryearcombo.getSelectedIndex();
+ }
+
+ }
+
+ if(!searchtext.isEmpty())
+ {
+ String searchquery="s.firstname like '"+searchtext+"%' or s.lastname like '"+searchtext+"%' or s.rollnumber like '"+searchtext+"%' ";
+ if(!query.contains("where"))
+ {
+ query+="where "+searchquery;
+ }
+ else
+ {
+ query+=" and ( "+searchquery+" ) ";
+ }
+
+ }
+ table.setModel(DbUtils.resultSetToTableModel(new StudentData().searchStudent(query)));
+ this.arrangeStudentTable();
+ }
+ else if(studentandfacultycombo.getSelectedIndex()==1)
+ {
+ String defaultquery="select facultyid as 'Faculty ID',facultyname as 'Faculty Name',emailid as 'Email ID',qualification as 'Qualification',experience as 'Experience' from faculties f ";
+ String query=defaultquery;
+ if(courcenamecombo.getSelectedIndex()>0)
+ {
+ String courcecode=new CourceData().getCourcecode(courcenamecombo.getSelectedItem()+"");
+ query+=" where f.courcecode='"+courcecode+"'";
+ if(semoryearcombo.getSelectedIndex()>0)
+ {
+ query+=" and f.semoryear="+semoryearcombo.getSelectedIndex();
+ }
+
+ }
+ if(!searchtext.equals("Search")&&!searchtext.isEmpty())
+ {
+ String searchquery=" f.facultyname like '"+searchtext+"%' or f.facultyid like '"+searchtext+"%' ";
+ if(!query.contains("where"))
+ {
+ query+="where "+searchquery;
+ }
+ else
+ {
+ query+=" and ( "+searchquery+" ) ";
+ }
+
+ }
+ table.setModel(DbUtils.resultSetToTableModel(new FacultyData().searchFaculty(query)));
+ this.arrangeFacultyTable();
+ }
+ }
+}
diff --git a/src/collegeapplication/common/TimeUtil.java b/src/collegeapplication/common/TimeUtil.java
new file mode 100644
index 0000000..d227435
--- /dev/null
+++ b/src/collegeapplication/common/TimeUtil.java
@@ -0,0 +1,86 @@
+package collegeapplication.common;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.Period;
+import java.util.Date;
+
+
+/*
+ * Title : TimeUtil.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : To get Current login time
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+
+public class TimeUtil {
+
+ static SimpleDateFormat formater=new SimpleDateFormat("dd-MMM-yyyy hh:mm:ss aaa");
+ public static String getCurrentTime()
+ {
+
+ Date logintime=new Date();
+ return formater.format(logintime);
+ }
+ @SuppressWarnings("deprecation")
+ public static int getDayDifference(String strdate1,String strdate2)
+ {
+ if(strdate1.isEmpty()||strdate2.isEmpty())
+ {
+ return -1;
+ }
+ SimpleDateFormat dateformatter=new SimpleDateFormat("dd-MMM,yyyy");
+ Date date1 = null;
+ try {
+ date1 = dateformatter.parse(strdate1);
+ } catch (ParseException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ Date date2 = null;
+ try {
+ date2 =dateformatter.parse(strdate2);
+ } catch (ParseException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ System.out.println(date1.getMonth());
+ System.out.println(date2.getMonth());
+ LocalDate dateone = LocalDate.of(date1.getYear(),date1.getMonth()+1, date1.getDate());
+ LocalDate datetwo = LocalDate.of(date2.getYear(),date2.getMonth()+1, date2.getDate());
+
+
+ Period diff = Period.between(dateone,datetwo);
+ return Math.abs(diff.getDays());
+ }
+
+ public static long getTimeDifference(String time1,String time2)
+ {
+ Date date1 = null;
+ try {
+ date1 = formater.parse(time1);
+ } catch (ParseException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ Date date2 = null;
+ try {
+ date2 = formater.parse(time2);
+ } catch (ParseException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ long diff=date2.getTime()-date1.getTime();
+// long diffSeconds = diff / 1000 % 60;
+// long diffMinutes = diff / (60 * 1000) % 60;
+// long diffHours = diff / (60 * 60 * 1000) % 24;
+ return diff;
+ }
+ public static void main(String a[])
+ {
+ System.out.println(getTimeDifference(getCurrentTime(),getCurrentTime()));
+ }
+
+}
diff --git a/src/collegeapplication/common/User.java b/src/collegeapplication/common/User.java
new file mode 100644
index 0000000..ad280c6
--- /dev/null
+++ b/src/collegeapplication/common/User.java
@@ -0,0 +1,95 @@
+package collegeapplication.common;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import collegeapplication.cource.Cource;
+import collegeapplication.faculty.FacultyData;
+import collegeapplication.student.StudentData;
+
+
+/*
+ * Title : User.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : Binding data related to login activity of students and faculties
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+
+class User extends Cource
+{
+
+
+ private String logindate;
+ private String logintime;
+ private String userid;
+ private String userprofile;
+
+ public void setLoginTime(String logintime)
+ {
+ SimpleDateFormat timeformatter=new SimpleDateFormat("hh:mm aaa");
+ SimpleDateFormat dateformatter=new SimpleDateFormat("dd-MMM,yyyy");
+ SimpleDateFormat formater=new SimpleDateFormat("dd-MMM-yyyy hh:mm:ss aaa");
+ Date date;
+ try {
+ date = formater.parse(logintime);
+ this.logintime=timeformatter.format(date);
+ this.logindate=dateformatter.format(date);
+ } catch (ParseException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+ public void setUserId(String userid)
+ {
+ this.userid=userid;
+ }
+ public void setUserProfile(String userprofile)
+ {
+ this.userprofile=userprofile;
+ }
+ public String getLoginTime()
+ {
+ return logintime;
+ }
+ public String getLoginDate()
+ {
+ if(getCurrentDate().equals(logindate))
+ {
+ return "today";
+ }
+
+ return logindate;
+ }
+ public String getCurrentDate()
+ {
+ Date date=new Date();
+ SimpleDateFormat dateformatter=new SimpleDateFormat("dd-MMM,yyyy");
+ String time=dateformatter.format(date);
+ return time;
+ }
+ public String getUserid()
+ {
+ return userid;
+ }
+ public String getUserProfile()
+ {
+ return userprofile;
+ }
+
+ public String getName()
+ {
+ if(getUserProfile().equals("Student"))
+ {
+ return new StudentData().getStudentName(userid);
+ }
+ else if(getUserProfile().equals("Faculty"))
+ {
+ return new FacultyData().getFacultyName(userid);
+ }
+ return "-";
+ }
+
+}
diff --git a/src/collegeapplication/common/UserData.java b/src/collegeapplication/common/UserData.java
new file mode 100644
index 0000000..56d3602
--- /dev/null
+++ b/src/collegeapplication/common/UserData.java
@@ -0,0 +1,96 @@
+
+package collegeapplication.common;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.ArrayList;
+
+import collegeapplication.faculty.Faculty;
+import collegeapplication.student.Student;
+
+
+/*
+ * Title : UserData.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : For getting all the data related to user login activity
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+
+public class UserData {
+ Connection con=DataBaseConnection.getConnection();
+
+ public int addStudentLoginTime(Student s)
+ {
+ int result=0;
+ try
+ {
+ String query="insert into users values(?,?,?,?,?,?)";
+ PreparedStatement pr=con.prepareStatement(query);
+ pr.setInt(1, 0);
+ pr.setString(2, s.getCourceCode());
+ pr.setInt(3,s.getSemorYear());
+ pr.setString(4,s.getUserId());
+ pr.setString(5,TimeUtil.getCurrentTime());
+ pr.setString(6, "Student");
+ result=pr.executeUpdate();
+
+ }
+ catch(Exception exp) {
+ exp.printStackTrace();
+ }
+ return result;
+ }
+ public int addFacultyLoginTime(Faculty s)
+ {
+ int result=0;
+ try
+ {
+ String query="insert into users values(?,?,?,?,?,?)";
+ PreparedStatement pr=con.prepareStatement(query);
+ pr.setInt(1, 0);
+ pr.setString(2, s.getCourceCode());
+ pr.setInt(3,s.getSemorYear());
+ pr.setString(4,s.getFacultyId()+"");
+ pr.setString(5,TimeUtil.getCurrentTime());
+ pr.setString(6, "Faculty");
+ result=pr.executeUpdate();
+
+ }
+ catch(Exception exp) {
+ exp.printStackTrace();
+ }
+ return result;
+ }
+ public ArrayList getUserInfo(String condition)
+ {
+ ArrayList list=new ArrayList();
+ try
+ {
+ String query="select courcecode as 'Cource',semoryear as 'Sem/Year',userid as 'Userid',logintime as 'Login Time',userprofile as 'User Profile' from users "+condition+" order by sr_no desc";
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ while(rs.next())
+ {
+ User user=new User();
+ user.setCourceCode(rs.getString(1));
+ user.setSemorYear(rs.getInt(2));
+ user.setUserId(rs.getString(3));
+ user.setLoginTime(rs.getString(4));
+ user.setUserProfile(rs.getString(5));
+ list.add(user);
+
+ }
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return list;
+ }
+
+}
+
diff --git a/src/collegeapplication/common/UsersPanel.java b/src/collegeapplication/common/UsersPanel.java
new file mode 100644
index 0000000..6e28fe2
--- /dev/null
+++ b/src/collegeapplication/common/UsersPanel.java
@@ -0,0 +1,185 @@
+package collegeapplication.common;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.LineBorder;
+import javax.swing.table.DefaultTableCellRenderer;
+import javax.swing.table.DefaultTableModel;
+
+import collegeapplication.admin.AdminMain;
+import collegeapplication.faculty.Faculty;
+import collegeapplication.faculty.FacultyData;
+import collegeapplication.faculty.ViewFacultyPanel;
+import collegeapplication.student.Student;
+import collegeapplication.student.StudentData;
+import collegeapplication.student.ViewStudentPanel;
+
+
+/*
+ * Title : UserPanel.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : To displaying users activity
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+@SuppressWarnings("serial")
+public class UsersPanel extends JPanel {
+
+ private JLabel headerlabel;
+ private JTable table;
+ String condition="";
+
+ /**
+ * Create the panel.
+ */
+
+ public UsersPanel(AdminMain am)
+ {
+ this();
+ createtablemodel();
+ table.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ if(e.getClickCount()>1&&e.getButton()==MouseEvent.BUTTON1)
+ {
+
+ JTable t=(JTable) e.getSource();
+ int row=t.getSelectedRow();
+ String userprofile=table.getValueAt(row, 0)+"";
+ String userid=table.getValueAt(row, 2)+"";
+ if(userprofile.equals("Student"))
+ {
+ Student s=new StudentData().getStudentDetailsByUserId(userid);
+ am.viewstudentpanel=new ViewStudentPanel(s,am,am.userspanel);
+ am.viewstudentpanel.setVisible(true);
+ am.userspanel.setVisible(false);
+ am.viewstudentpanel.setLocation(am.panelx,0);
+ am.viewstudentpanel.setVisible(true);
+ am.viewstudentpanel.setFocusable(true);
+ am.contentPane.add(am.viewstudentpanel);
+ }
+ else if(userprofile.equals("Faculty"))
+ {
+ int fid=Integer.parseInt(userid);
+ Faculty f=new FacultyData().getFacultyInfobyId(fid);
+ am.viewfacultypanel=new ViewFacultyPanel(f,am,am.userspanel);
+ am.viewfacultypanel.setVisible(true);
+ am.userspanel.setVisible(false);
+ am.viewfacultypanel.setLocation(am.panelx,am.panely);
+ am.viewfacultypanel.setVisible(true);
+ am.viewfacultypanel.setFocusable(true);
+ am.contentPane.add(am.viewfacultypanel);
+ }
+
+
+ }
+
+ }
+ });
+ }
+ public UsersPanel() {
+ setBackground(Color.WHITE);
+ this.setSize(1116, 705);
+ setLayout(null);
+ setName("Users Panel");
+
+ headerlabel = new JLabel(" Users");
+ headerlabel.setBackground(new Color(32, 178, 170));
+ headerlabel.setForeground(new Color(255, 255, 255));
+ headerlabel.setFont(new Font("Segoe UI", Font.BOLD, 30));
+ headerlabel.setHorizontalAlignment(JLabel.LEFT);
+ headerlabel.setBounds(10, 0, 1096, 183);
+ headerlabel.setOpaque(true);
+ add(headerlabel);
+
+ JScrollPane scrollPane = new JScrollPane();
+ scrollPane.setBorder(new EmptyBorder(0, 0, 0, 0));
+ scrollPane.setBounds(10, 194, 1096, 500);
+ for(Component c:scrollPane.getComponents())
+ {
+ c.setBackground(Color.white);
+ }
+ add(scrollPane);
+
+ table = new JTable();
+ table.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ table.getTableHeader().setBackground(new Color(32,178,170));
+ table.getTableHeader().setForeground(Color.white);
+ table.setSelectionBackground(new Color(240, 255, 255));
+ table.getTableHeader().setFont(new Font("Arial",Font.BOLD,20));
+ table.setFont(new Font("Segoe UI",Font.PLAIN,20));
+ table.getTableHeader().setPreferredSize(new Dimension(50,40));
+ table.setFocusable(false);
+ table.setDragEnabled(false);
+ table.setRowHeight(40);
+ table.setDefaultEditor(Object.class, null);
+ table.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ table.setGridColor(Color.LIGHT_GRAY);
+ table.getTableHeader().setReorderingAllowed(false);
+ scrollPane.setViewportView(table);
+
+ }
+
+ public void createtablemodel()
+ {
+ ArrayList list=new UserData().getUserInfo(condition);
+ String Column[]= {"User Profile","Class","User id","User name","Login Date","Login Time"};
+ DefaultTableModel model=new DefaultTableModel(Column,0);
+ for(int i=0; i0)
+ {
+ return Printable.NO_SUCH_PAGE;
+ }
+ Graphics2D g=(Graphics2D) pg;
+ g.translate(pf.getImageableX(), pf.getImageableY());
+ g.scale(0.543,0.60);
+
+ //printing marksheetpanel graphics to Printable graphics
+ if(am!=null)
+ {
+ am.marksheetpanel.print(g);
+ }
+ else if(fm!=null)
+ {
+ fm.marksheetpanel.print(g);
+ }
+ else if(sm!=null)
+ {
+ sm.marksheetpanel.print(g);
+ }
+
+ return 0;
+
+
+ }
+
+ public void setPdfTitle(String title)
+ {
+ this.title=title;
+ }
+
+ public void setPath(String path)
+ {
+ this.pdfpath=path;
+ }
+ public void disposeDialog(PrintMarksheetDialog pgd)
+ {
+ this.pgd=pgd;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent event) {
+
+
+ try
+ {
+
+
+ String printerName = "Microsoft Print to Pdf";
+ //find the printService of name printerName
+ PrintService ps = findPrintService(printerName);
+ // create a printerJob
+ PrinterJob job = PrinterJob.getPrinterJob();
+
+ //set the printService found (should be tested)
+ job.setPrintService(ps);
+ job.setPrintable(this);
+ job.setJobName(title);
+ if(am!=null)
+ {
+ am.marksheetpanel.disablebutton();
+
+ }
+ else if(fm!=null)
+ {
+ fm.marksheetpanel.disablebutton();
+ }
+ else if(sm!=null)
+ {
+ sm.marksheetpanel.downloadbutton.setVisible(false);
+ }
+ Paper paper = new Paper();
+ paper.setSize(595, 842); // A4 dimensions in font points
+ paper.setImageableArea(0, 0, paper.getWidth() * 2, paper.getHeight());
+
+ PageFormat pageFormat = new PageFormat();
+ pageFormat.setPaper(paper);
+ pageFormat.setOrientation(PageFormat.PORTRAIT);
+
+ Book book = new Book();// java.awt.print.Book
+ book.append(pgd.p, pageFormat);
+ job.setPageable(book);
+
+ HashPrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
+ // set the output file as a destination
+ attributes.add(new Destination(new File(pdfpath).toURI()));
+
+ //printing pdf
+ job.print(attributes);
+
+ if(am!=null)
+ {
+ am.marksheetpanel.enablebutton();
+ }
+ else if(fm!=null)
+ {
+ fm.marksheetpanel.enablebutton();
+ }
+ else if(sm!=null)
+ {
+ sm.marksheetpanel.setVisible(true);
+ }
+ pgd.afterbutton((JButton) event.getSource());
+ }
+ catch (PrinterException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/src/collegeapplication/cource/AddCourceDialog.java b/src/collegeapplication/cource/AddCourceDialog.java
new file mode 100644
index 0000000..42303df
--- /dev/null
+++ b/src/collegeapplication/cource/AddCourceDialog.java
@@ -0,0 +1,245 @@
+package collegeapplication.cource;
+
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.MatteBorder;
+
+import collegeapplication.common.HintTextField;
+
+import java.awt.Color;
+import javax.swing.JLabel;
+import javax.swing.SwingConstants;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JTextField;
+import javax.swing.JComboBox;
+import javax.swing.DefaultComboBoxModel;
+
+
+/*
+ * Title : AddCourceDialog.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : Dialog for adding new cource
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+@SuppressWarnings("serial")
+public class AddCourceDialog extends JDialog implements ActionListener
+{
+
+ private JTextField courcecodefield;
+ private JTextField courcenamefield;
+ private JTextField totalsemoryearfield;
+ private JComboBox semoryearcombo;
+ private JLabel lblError;
+ private CourcePanel courcepanel;
+
+ /**
+ * Launch the application.
+ */
+ public static void main(String[] args) {
+ try {
+ AddCourceDialog dialog = new AddCourceDialog();
+
+ dialog.setVisible(true);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Create the dialog.
+ */
+ public AddCourceDialog(CourcePanel courcepanel)
+ {
+ this();
+ this.courcepanel=courcepanel;
+ }
+ public AddCourceDialog() {
+
+ setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+ setResizable(false);
+ setModalityType(ModalityType.APPLICATION_MODAL);
+ getContentPane().setBackground(Color.WHITE);
+ setBounds(100, 100, 476, 452);
+ getContentPane().setLayout(null);
+
+ JLabel lblAddNewCource = new JLabel("Add New Cource");
+ lblAddNewCource.setForeground(new Color(255, 255, 255));
+ lblAddNewCource.setBackground(new Color(32, 178, 170));
+ lblAddNewCource.setOpaque(true);
+ lblAddNewCource.setFont(new Font("Arial", Font.BOLD, 23));
+ lblAddNewCource.setHorizontalAlignment(SwingConstants.CENTER);
+ lblAddNewCource.setBounds(0, 0, 473, 55);
+ getContentPane().add(lblAddNewCource);
+
+ JLabel lblCourceCode = new JLabel("Cource Code ");
+ lblCourceCode.setBorder(new EmptyBorder(0, 0, 0, 5));
+ lblCourceCode.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ lblCourceCode.setHorizontalAlignment(SwingConstants.LEFT);
+ lblCourceCode.setBounds(10, 79, 139, 24);
+ lblCourceCode.setFocusable(true);
+ getContentPane().add(lblCourceCode);
+
+ JLabel lblCourceName = new JLabel("Cource Name ");
+ lblCourceName.setHorizontalAlignment(SwingConstants.LEFT);
+ lblCourceName.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ lblCourceName.setBorder(new EmptyBorder(0, 0, 0, 5));
+ lblCourceName.setBounds(10, 147, 139, 24);
+ getContentPane().add(lblCourceName);
+
+ JLabel lblSemyear = new JLabel("Sem/Year");
+ lblSemyear.setHorizontalAlignment(SwingConstants.LEFT);
+ lblSemyear.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ lblSemyear.setBorder(new EmptyBorder(0, 0, 0, 5));
+ lblSemyear.setBounds(10, 218, 139, 24);
+ getContentPane().add(lblSemyear);
+
+ courcecodefield = new HintTextField("");
+ courcecodefield.setFont(new Font("Segoe UI Emoji", Font.PLAIN, 18));
+ courcecodefield.setBounds(157, 72, 292, 40);
+ getContentPane().add(courcecodefield);
+ courcecodefield.setColumns(10);
+
+ courcenamefield = new HintTextField("");
+ courcenamefield.setFont(new Font("Segoe UI Emoji", Font.PLAIN, 18));
+ courcenamefield.setColumns(10);
+ courcenamefield.setBounds(159, 141, 292, 40);
+ getContentPane().add(courcenamefield);
+
+ totalsemoryearfield = new HintTextField("");
+ totalsemoryearfield.setFont(new Font("Segoe UI Emoji", Font.PLAIN, 18));
+ totalsemoryearfield.setColumns(10);
+ totalsemoryearfield.setBounds(157, 278, 292, 40);
+ getContentPane().add(totalsemoryearfield);
+
+ semoryearcombo = new JComboBox();
+ semoryearcombo.setFont(new Font("Segoe UI", Font.PLAIN, 16));
+ semoryearcombo.setModel(new DefaultComboBoxModel(new String[] {"---Select Sem/Year---", "sem", "year"}));
+ semoryearcombo.setBounds(159, 210, 292, 40);
+ getContentPane().add(semoryearcombo);
+
+ JLabel lblTotalSemyear = new JLabel("Total Sem/Year");
+ lblTotalSemyear.setHorizontalAlignment(SwingConstants.LEFT);
+ lblTotalSemyear.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ lblTotalSemyear.setBorder(new EmptyBorder(0, 0, 0, 5));
+ lblTotalSemyear.setBounds(10, 284, 139, 24);
+ getContentPane().add(lblTotalSemyear);
+
+ JButton addcourcebutton = new JButton("Add Cource");
+ addcourcebutton.setBackground(new Color(32, 178, 170));
+ addcourcebutton.setForeground(new Color(255, 255, 255));
+ addcourcebutton.setFont(new Font("Segoe UI", Font.BOLD, 14));
+ addcourcebutton.setBounds(310, 373, 139, 37);
+ addcourcebutton.addActionListener(this);
+ getContentPane().add(addcourcebutton);
+
+ lblError=new JLabel("This is required question !");
+ lblError.setBorder(new MatteBorder(0, 0, 0, 0, (Color) new Color(255, 0, 0)));
+ lblError.setForeground(new Color(255, 0, 0));
+ lblError.setFont(new Font("Candara", Font.PLAIN, 15));
+ lblError.setVisible(false);
+ lblError.setBounds(157,115,355,21);
+ getContentPane().add(lblError);
+
+ JLabel label = new JLabel("");
+ label.setBorder(new MatteBorder(0, 0, 2, 0, (Color) new Color(192, 192, 192)));
+ label.setBounds(0, 346, 470, 14);
+ getContentPane().add(label);
+
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ lblError.setForeground(Color.red);
+ lblError.setVisible(false);
+ lblError.setText("This is required question !");
+ String courcename=courcenamefield.getText();
+ String courcecode=courcecodefield.getText();
+ String semoryear=(String) semoryearcombo.getSelectedItem();
+ String strtotalsemoryear=totalsemoryearfield.getText();
+ if(courcecode.isEmpty())
+ {
+ lblError.setVisible(true);
+ lblError.setBounds(courcecodefield.getX(), courcecodefield.getY()+courcecodefield.getHeight(), lblError.getWidth(), 21);
+ courcecodefield.setFocusable(true);
+ }
+
+ else if(courcename.isEmpty())
+ {
+ lblError.setVisible(true);
+ lblError.setBounds(courcenamefield.getX(), courcenamefield.getY()+courcenamefield.getHeight(), lblError.getWidth(), 21);
+ courcenamefield.setFocusable(true);
+ }
+ else if(semoryearcombo.getSelectedIndex()==0)
+ {
+ lblError.setVisible(true);
+ lblError.setBounds(semoryearcombo.getX(), semoryearcombo.getY()+semoryearcombo.getHeight(), lblError.getWidth(), 21);
+
+ }
+ else if(strtotalsemoryear.isEmpty())
+ {
+
+ lblError.setVisible(true);
+ lblError.setBounds(totalsemoryearfield.getX(), totalsemoryearfield.getY()+totalsemoryearfield.getHeight(), lblError.getWidth(), 21);
+ totalsemoryearfield.setFocusable(true);
+ }
+
+ else
+ {
+
+ try
+ {
+ int totalsemoryear=Integer.parseInt(strtotalsemoryear);
+ if(new CourceData().isCourceCodeExist(courcecode.toUpperCase()))
+ {
+ lblError.setVisible(true);
+ lblError.setBounds(courcecodefield.getX(), courcecodefield.getY()+courcecodefield.getHeight(), lblError.getWidth(), 21);
+ lblError.setText("Cource code already exist !");
+ }
+ else if(new CourceData().isCourceNameExist(courcename))
+ {
+ lblError.setVisible(true);
+ lblError.setBounds(courcenamefield.getX(), courcenamefield.getY()+courcenamefield.getHeight(), lblError.getWidth(), 21);
+ courcenamefield.setFocusable(true);
+ lblError.setText("Cource name already exist !");
+ }
+ else if(totalsemoryear<1)
+ {
+ lblError.setVisible(true);
+ lblError.setBounds(totalsemoryearfield.getX(), totalsemoryearfield.getY()+totalsemoryearfield.getHeight(), lblError.getWidth(), 21);
+ lblError.setText("Minimun 1 sem/year required !");
+ }
+ else
+ {
+ CourceData c=new CourceData();
+ int result=c.addCource(courcecode, courcename, semoryear, totalsemoryear);
+ if(result>0)
+ {
+
+ if(courcepanel!=null)
+ {
+ courcepanel.updatetableData();
+ }
+ this.dispose();
+ }
+
+ }
+ }
+ catch(NumberFormatException nexp)
+ {
+ lblError.setVisible(true);
+ lblError.setBounds(totalsemoryearfield.getX(), totalsemoryearfield.getY()+totalsemoryearfield.getHeight(), lblError.getWidth(), 21);
+ lblError.setText("Characters are not allowed !");
+ }
+
+
+ }
+
+ }
+
+}
diff --git a/src/collegeapplication/cource/Cource.java b/src/collegeapplication/cource/Cource.java
new file mode 100644
index 0000000..5686ef3
--- /dev/null
+++ b/src/collegeapplication/cource/Cource.java
@@ -0,0 +1,41 @@
+package collegeapplication.cource;
+
+public class Cource {
+
+ private String courcecode;
+ private int semoryear;
+ private boolean isdeclared;
+ private String courcename;
+ public void setCourceName(String courcename)
+ {
+ this.courcename=courcename;
+ }
+ public void setCourceCode(String courcecode)
+ {
+ this.courcecode=courcecode;
+ }
+ public void setSemorYear(int semoryear)
+ {
+ this.semoryear=semoryear;
+ }
+ public void setIsDeclared(boolean isdeclared)
+ {
+ this.isdeclared=isdeclared;
+ }
+ public String getCourceName()
+ {
+ return courcename!=null?courcename:new CourceData().getcourcename(courcecode);
+ }
+ public String getCourceCode()
+ {
+ return courcecode;
+ }
+ public int getSemorYear()
+ {
+ return semoryear;
+ }
+ public boolean getIsDeclared()
+ {
+ return isdeclared;
+ }
+}
diff --git a/src/collegeapplication/cource/CourceData.java b/src/collegeapplication/cource/CourceData.java
new file mode 100644
index 0000000..5136215
--- /dev/null
+++ b/src/collegeapplication/cource/CourceData.java
@@ -0,0 +1,486 @@
+package collegeapplication.cource;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+
+import collegeapplication.common.DataBaseConnection;
+import collegeapplication.common.Notification;
+import collegeapplication.common.NotificationData;
+import collegeapplication.common.TimeUtil;
+
+
+/*
+ * Title : UserData.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : Handling all the data related to cource
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+public class CourceData
+{
+
+ static Connection con=DataBaseConnection.getConnection();
+
+ public static void closeConnection() throws SQLException
+ {
+ con.close();
+ }
+ public int addCource(String courcecode,String courcename,String semoryear,int totalyearorsem)
+ {
+ int result=0;
+ try
+ {
+ String query="insert into cources values(?,?,?,?,?)";
+ PreparedStatement pr=con.prepareStatement(query);
+ pr.setInt(1,0);
+ pr.setString(2, courcecode.toUpperCase());
+ pr.setString(3, courcename);
+ pr.setString(4, semoryear);
+ pr.setInt(5, totalyearorsem);
+ result=pr.executeUpdate();
+
+ pr.close();
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return result;
+ }
+
+ public ResultSet getCourceinfo()
+ {
+
+ ResultSet st=null;
+ try
+ {
+ String query="select c.sr_no as 'Index no.',c.courcecode as 'Cource Code' ,c.courcename as 'Cource Name',(select count(*) from subject where subject.courcecode=c.courcecode) as 'Subjects' ,(select count(*) from students where students.courcecode=c.courcecode) as 'Students',concat(c.totalsemoryear,' ',c.semoryear) as 'Total Sem/Year' from cources c;";
+ PreparedStatement pr=con.prepareStatement(query);
+
+ st=pr.executeQuery();
+ return st;
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return st;
+ }
+ public int getTotalCource()
+ {
+ int totalrow=0;
+ try
+ {
+ Statement pr=con.createStatement();
+ ResultSet st=pr.executeQuery("select * from cources");
+ while(st.next())
+ {
+ totalrow++;
+ }
+ pr.close();
+
+ return totalrow;
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return totalrow;
+ }
+
+
+
+ public String[] getCourceName()
+ {
+ String courcename[];
+ int i=0;
+ courcename=new String[getTotalCource()+1];
+ courcename[i++]="---Select Cource---";
+
+ try
+ {
+ Statement pr=con.createStatement();
+ ResultSet st=pr.executeQuery("select courcename from cources");
+
+
+ while(st.next())
+ {
+ courcename[i++]=st.getString(1);
+ }
+ pr.close();
+ st.close();
+ return courcename;
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return courcename;
+
+ }
+ public int getRollTotalCource()
+ {
+ int totalrow=0;
+ try
+ {
+ Statement pr=con.createStatement();
+ ResultSet st=pr.executeQuery("select courcename from cources where courcecode Not IN(select distinct courcecode from rollgenerator)");
+ while(st.next())
+ {
+ totalrow++;
+ }
+ pr.close();
+ st.close();
+ return totalrow;
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return totalrow;
+ }
+ public String[] getRollCourceName()
+ {
+ String courcename[];
+ int i=0;
+ courcename=new String[getRollTotalCource()+1];
+ courcename[i++]="---select---";
+
+ try
+ {
+ Statement pr=con.createStatement();
+ ResultSet st=pr.executeQuery("select courcename from cources where courcecode NOT IN(select distinct courcecode from rollgenerator)");
+
+
+ while(st.next())
+ {
+ courcename[i++]=st.getString(1);
+ }
+ pr.close();
+ st.close();
+ return courcename;
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return courcename;
+
+ }
+ public String[] getSemorYear(String Courcename)
+ {
+ String query="select semoryear, totalsemoryear from cources where courcename='"+Courcename+"'";
+ String totalsem[]=new String[1];
+ totalsem[0]="---Select Sem/Year---";
+ if(!Courcename.contains("--select--"))
+ {
+ try
+ {
+ Statement pr=con.createStatement();
+ ResultSet st=pr.executeQuery(query);
+ st.next();
+ String semoryear=st.getString(1);
+ int totalsemoryear=st.getInt(2);
+
+ totalsem=new String[totalsemoryear+1];
+ if(semoryear.contains("sem"))
+ {
+ semoryear="Semester";
+ }
+ else
+ {
+ semoryear="Year";
+ }
+ totalsem[0]="---Select "+semoryear+"---";
+ for(int i=1; i<=totalsemoryear; i++)
+ {
+ totalsem[i]=semoryear+" "+i;
+ }
+ pr.close();
+ st.close();
+ return totalsem;
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ }
+ return totalsem;
+
+ }
+ public String[] getCourcecode()
+ {
+ String courcecode[]=new String[this.getTotalCource()];
+ String query="select courcecode from cources";
+ try
+ {
+ Statement pr=con.createStatement();
+ ResultSet st=pr.executeQuery(query);
+ int i=0;
+ while(st.next())
+ {
+ courcecode[i++]=st.getString(1);
+ }
+ pr.close();
+ st.close();
+
+ return courcecode;
+
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return courcecode;
+
+
+ }
+ public String getCourcecode(String courcename)
+ {
+ String query="select courcecode from cources where courcename='"+courcename+"'";
+ String courcecode=null;
+ try
+ {
+ Statement pr=con.createStatement();
+ ResultSet st=pr.executeQuery(query);
+
+ st.next();
+ courcecode=st.getString(1);
+
+ pr.close();
+ st.close();
+ return courcecode;
+
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return courcecode;
+ }
+ public String getsemoryear(String courcecode)
+ {
+ String query="select semoryear from cources where courcecode='"+courcecode+"'";
+ String semoryear=null;
+ try
+ {
+ Statement pr=con.createStatement();
+ ResultSet st=pr.executeQuery(query);
+
+ st.next();
+ semoryear=st.getString(1);
+
+ pr.close();
+ st.close();
+ return semoryear;
+
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return semoryear;
+ }
+ public String getcourcename(String courcecode)
+ {
+ String query="select courcename from cources where courcecode='"+courcecode+"'";
+ String courcename=null;
+ try
+ {
+ Statement pr=con.createStatement();
+ ResultSet st=pr.executeQuery(query);
+
+ st.next();
+ courcename=st.getString(1);
+
+ pr.close();
+ st.close();
+ return courcename;
+
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return courcename;
+ }
+ public int getTotalsemoryear(String courcename)
+ {
+ String query="select totalsemoryear from cources where courcename='"+courcename+"'";
+ int totalsemoryear=0;
+ try
+ {
+ Statement pr=con.createStatement();
+ ResultSet st=pr.executeQuery(query);
+ while(st.next())
+ {
+ totalsemoryear=st.getInt(1);
+ }
+ pr.close();
+ st.close();
+
+ return totalsemoryear;
+
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return totalsemoryear;
+ }
+ public boolean isCourceCodeExist(String courcecode)
+ {
+ try
+ {
+
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery("select count(*) from cources where courcecode='"+courcecode+"'");
+ rs.next();
+ if(rs.getInt(1)>0)
+ {
+ return true;
+ }
+ rs.close();
+ st.close();
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ return false;
+ }
+ public boolean isCourceNameExist(String courcename)
+ {
+ try
+ {
+
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery("select count(*) from cources where courcename='"+courcename+"'");
+ rs.next();
+ if(rs.getInt(1)>0)
+ {
+ return true;
+ }
+ rs.close();
+ st.close();
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ return false;
+ }
+ public boolean isDeclared(String courcecode,int semoryear)
+ {
+ boolean isdeclared=false;
+ try
+ {
+ String query="select isdeclared from result where courcecode='"+courcecode+"' and semoryear="+semoryear;
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ while(rs.next())
+ {
+ isdeclared=rs.getBoolean(1);
+ }
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return isdeclared;
+ }
+ public ArrayList getCourcesForDeclareResult(String courcename)
+ {
+ ArrayList list=new ArrayList();
+ try
+ {
+ String query="select courcename,courcecode,totalsemoryear from cources where courcename='"+courcename+"'";
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ while(rs.next())
+ {
+ int totalsem=rs.getInt(3);
+ for(int i=0; icourcenamecombo;
+ JScrollPane scrollPane;
+ JTable table;
+ JPanel panel;
+ JButton btnSave;
+ JTextField tf[];
+ JLabel lblError;
+ RollGeneratorPanel rp=null;
+ JLabel lblSelectCource,courcenamelabel;
+ JScrollPane rollgenscroll;
+ private int sem;
+ private String courcecode="";
+ private static RollGeneratorDialog dialog;
+ /**
+ * Launch the application.
+ */
+ public static void main(String[] args) {
+ try {
+ dialog = new RollGeneratorDialog();
+ dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+ dialog.setLocation(400, 100);
+ dialog.setVisible(true);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Create the dialog.
+ * @param courcenamecombo
+ */
+ public RollGeneratorDialog() {
+ super(dialog,"",Dialog.ModalityType.APPLICATION_MODAL);
+ this.setLocation(400,100);
+ getContentPane().setBackground(new Color(255, 255, 255));
+ setResizable(false);
+ setSize(620, 282);
+ getContentPane().setLayout(null);
+
+ JLabel headingLabel = new JLabel("Roll number Generator ");
+ headingLabel.setBorder(new MatteBorder(0, 0, 1, 0, (Color) Color.LIGHT_GRAY));
+ headingLabel.setOpaque(true);
+ headingLabel.setBounds(0, 0, this.getWidth(), 44);
+ headingLabel.setBackground(new Color(32, 178, 170));
+ headingLabel.setForeground(new Color(255, 255, 255));
+ headingLabel.setFont(new Font("Arial", Font.BOLD, 23));
+ headingLabel.setHorizontalAlignment(SwingConstants.CENTER);
+ getContentPane().add(headingLabel);
+
+ panel = new JPanel();
+ panel.setBorder(new MatteBorder(1, 0, 0, 0, (Color) new Color(192, 192, 192)));
+ panel.setBackground(new Color(255, 255, 255));
+ panel.setBounds(0, this.getHeight()-82, 599, 53);
+ getContentPane().add(panel);
+ panel.setLayout(null);
+
+ btnSave = new JButton("Save");
+ btnSave.setBorder(new EmptyBorder(0, 0, 0, 0));
+ btnSave.setFocusable(false);
+ btnSave.setBackground(new Color(32, 178, 170));
+ btnSave.setForeground(Color.WHITE);
+ btnSave.addActionListener(this);
+ btnSave.setFont(new Font("Arial", Font.BOLD, 17));
+ btnSave.setBounds(450, 11, 139, 33);
+ btnSave.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ panel.add(btnSave);
+
+ lblError = new JLabel("Error : Only number allowed");
+ lblError.setFont(new Font("Tahoma", Font.PLAIN, 15));
+ lblError.setForeground(Color.RED);
+ lblError.setBounds(10, 11, 396, 29);
+ lblError.setVisible(false);
+ panel.add(lblError);
+
+ courcenamecombo = new JComboBox(new CourceData().getRollCourceName());
+ courcenamecombo.setForeground(Color.DARK_GRAY);
+ courcenamecombo.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ courcenamecombo.setFocusable(false);
+ courcenamecombo.addActionListener(this);
+ courcenamecombo.setBackground(Color.WHITE);
+ courcenamecombo.setBounds(182, 93, 407, 37);
+ getContentPane().add(courcenamecombo);
+
+
+ lblSelectCource = new JLabel("Select Course :");
+ lblSelectCource.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblSelectCource.setForeground(new Color(0, 0, 0));
+ lblSelectCource.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ lblSelectCource.setBounds(10, 93, 162, 37);
+ getContentPane().add(lblSelectCource);
+
+ rollgenscroll=new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ getContentPane().add(rollgenscroll);
+ this.setSize(620,262);
+ panel.setBounds(0, this.getHeight()-82, this.getWidth()-6, 53);
+ }
+
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO Auto-generated method stub
+
+
+ if(e.getSource()==courcenamecombo&&courcenamecombo.getSelectedIndex()>0)
+ {
+ if(rollgenscroll!=null)
+ {
+ rollgenscroll.setVisible(false);
+
+ }
+
+ {
+ sem=new CourceData().getTotalsemoryear(""+courcenamecombo.getSelectedItem());
+ courcecode=new CourceData().getCourcecode(""+courcenamecombo.getSelectedItem());
+
+ rp=new RollGeneratorPanel(courcecode,sem);
+ rp.setLocation(0,0);
+ rp.setVisible(true);
+ rollgenscroll.setViewportView(rp);
+
+ rollgenscroll.setLocation(0, 150);
+ rollgenscroll.getVerticalScrollBar().setUnitIncrement(80);
+ rollgenscroll.setVisible(true);
+ rollgenscroll.setSize(620,sem<5?rp.getHeight()+5:4*62);
+ this.setSize(620,rollgenscroll.getHeight()+262);
+ panel.setBounds(0, this.getHeight()-82, this.getWidth()-6, 53);
+ }
+ }
+ else if(e.getSource()==courcenamecombo&&courcenamecombo.getSelectedIndex()==0)
+ {
+ if(rollgenscroll!=null)
+ {
+ rollgenscroll.setSize(620,0);
+ this.setSize(620,rollgenscroll.getHeight()+262);
+ panel.setBounds(0, this.getHeight()-82, this.getWidth()-6, 53);
+ rollgenscroll.setVisible(false);
+ }
+ }
+
+ if(e.getSource()==btnSave&&!CheckError() && courcenamecombo.getSelectedIndex()!=0)
+ {
+ String courcecode=new CourceData().getCourcecode(""+courcenamecombo.getSelectedItem());
+ this.adddatatotable(courcecode, sem);
+ this.dispose();
+ }
+
+ }
+ public boolean CheckError()
+ {
+ int limit=sem;
+ for(int i=0; i gendercombo;
+ FacultyPanel fp;
+ private AdminMain am;
+ private Faculty faculty;
+ private JLabel headerlabel;
+ /**
+ * Launch the application.
+ */
+ public static void main(String[] args) {
+ try {
+ dialog = new AddFaculityDialog();
+ dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+
+ dialog.setVisible(true);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Create the dialog.
+ */
+ public AddFaculityDialog() {
+
+ super(dialog,"",Dialog.ModalityType.APPLICATION_MODAL);
+
+ setResizable(false);
+ getContentPane().setBackground(Color.WHITE);
+ setBounds(350, 20, 711, 680);
+ contentPanel.setLayout(null);
+ contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
+ getContentPane().setLayout(null);
+ headerlabel = new JLabel("Add New Faculity");
+ headerlabel.setFont(new Font("Segoe UI", Font.PLAIN, 15));
+ headerlabel.setHorizontalAlignment(SwingConstants.CENTER);
+ headerlabel.setBounds(0, 0, 695, 42);
+ getContentPane().add(headerlabel);
+
+ headerlabel.setBackground(new Color(32, 178, 170));
+ headerlabel.setOpaque(true);
+ headerlabel.setForeground(new Color(255, 255, 255));
+ headerlabel.setFont(new Font("Arial", Font.BOLD, 23));
+ headerlabel.setBorder(new MatteBorder(0, 0, 1, 0, (Color) Color.LIGHT_GRAY));
+
+ JLabel faculityidlabel = new JLabel("Faculty ID");
+ faculityidlabel.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ faculityidlabel.setBounds(21, 53, 134, 29);
+ getContentPane().add(faculityidlabel);
+
+ facultyidfield = new JTextField(new FacultyData().createFacultyID()+"");
+ facultyidfield.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ facultyidfield.setEditable(false);
+ facultyidfield.setBounds(20, 85, 323, 42);
+ getContentPane().add(facultyidfield);
+ facultyidfield.setColumns(10);
+
+ JLabel lblFaculityName = new JLabel("Faculty Name");
+ lblFaculityName.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ lblFaculityName.setBounds(362, 53, 166, 29);
+ getContentPane().add(lblFaculityName);
+
+ facultynamefield = new JTextField();
+ facultynamefield.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent arg0) {
+ facultynamefield.setFocusable(true);
+ }
+ });
+ facultynamefield.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if(e.getKeyCode()==KeyEvent.VK_ENTER)
+ {
+ facultynamefield.setFocusable(false);
+ }
+
+ }
+ });
+ facultynamefield.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ facultynamefield.setColumns(10);
+ facultynamefield.setBounds(362, 85, 323, 42);
+ getContentPane().add(facultynamefield);
+
+ JLabel lblState = new JLabel("State");
+ lblState.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ lblState.setBounds(21, 145, 134, 21);
+ getContentPane().add(lblState);
+
+ statefield = new JTextField();
+ statefield.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ statefield.setColumns(10);
+ statefield.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if(e.getKeyCode()==KeyEvent.VK_ENTER)
+ {
+ statefield.setFocusable(false);
+ }
+
+ }
+ });
+ statefield.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent arg0) {
+ statefield.setFocusable(true);
+ }
+ });
+ statefield.setBounds(21, 173, 322, 42);
+ getContentPane().add(statefield);
+
+ JLabel lblCity = new JLabel("City");
+ lblCity.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ lblCity.setBounds(362, 141, 143, 29);
+ getContentPane().add(lblCity);
+
+ cityfield = new JTextField();
+ cityfield.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ cityfield.setColumns(10);
+ cityfield.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if(e.getKeyCode()==KeyEvent.VK_ENTER)
+ {
+ cityfield.setFocusable(false);
+ }
+
+ }
+ });
+ cityfield.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent arg0) {
+ cityfield.setFocusable(true);
+ }
+ });
+ cityfield.setBounds(362, 173, 323, 42);
+ getContentPane().add(cityfield);
+
+ JLabel lblEmailId = new JLabel("Email ID");
+ lblEmailId.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ lblEmailId.setBounds(21, 231, 134, 29);
+ getContentPane().add(lblEmailId);
+
+ emailidfield = new JTextField();
+ emailidfield.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ emailidfield.setColumns(10);
+ emailidfield.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if(e.getKeyCode()==KeyEvent.VK_ENTER)
+ {
+ emailidfield.setFocusable(false);
+ }
+
+ }
+ });
+ emailidfield.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent arg0) {
+ emailidfield.setFocusable(true);
+ }
+ });
+ emailidfield.setBounds(21, 260, 322, 42);
+ getContentPane().add(emailidfield);
+
+ JLabel lblPhoneNumber = new JLabel("Contact Number");
+ lblPhoneNumber.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ lblPhoneNumber.setBounds(362, 226, 185, 29);
+ getContentPane().add(lblPhoneNumber);
+
+ contactnumberfield = new JTextField();
+ contactnumberfield.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ contactnumberfield.setColumns(10);
+ contactnumberfield.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if(e.getKeyCode()==KeyEvent.VK_ENTER)
+ {
+ contactnumberfield.setFocusable(false);
+ }
+
+ }
+ });
+ contactnumberfield.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent arg0) {
+ contactnumberfield.setFocusable(true);
+ }
+ });
+ contactnumberfield.setBounds(362, 260, 323, 42);
+ getContentPane().add(contactnumberfield);
+
+ JLabel lblQualification = new JLabel("Qualification");
+ lblQualification.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ lblQualification.setBounds(21, 326, 134, 29);
+ getContentPane().add(lblQualification);
+
+ qualificationfield = new JTextField();
+ qualificationfield.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ qualificationfield.setColumns(10);
+ qualificationfield.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if(e.getKeyCode()==KeyEvent.VK_ENTER)
+ {
+ qualificationfield.setFocusable(false);
+ }
+
+ }
+ });
+ qualificationfield.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent arg0) {
+ qualificationfield.setFocusable(true);
+ }
+ });
+ qualificationfield.setBounds(21, 355, 322, 42);
+ getContentPane().add(qualificationfield);
+
+ JLabel lblExperience = new JLabel("Experience");
+ lblExperience.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ lblExperience.setBounds(362, 326, 134, 29);
+ getContentPane().add(lblExperience);
+
+ experiencefield = new JTextField();
+ experiencefield.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ experiencefield.setColumns(10);
+ experiencefield.setBounds(362, 355, 322, 42);
+ experiencefield.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if(e.getKeyCode()==KeyEvent.VK_ENTER)
+ {
+ experiencefield.setFocusable(false);
+ }
+
+ }
+ });
+ experiencefield.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent arg0) {
+ experiencefield.setFocusable(true);
+ }
+ });
+ getContentPane().add(experiencefield);
+
+ JLabel doblabel = new JLabel("Date of Birth");
+ doblabel.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ doblabel.setBounds(21, 414, 134, 29);
+ getContentPane().add(doblabel);
+
+ birthdatespinner = new JSpinner();
+ birthdatespinner.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ birthdatespinner.setModel(new SpinnerDateModel());
+ SimpleDateFormat model=new SimpleDateFormat("dd-MM-yyyy");
+ birthdatespinner.setEditor(new JSpinner.DateEditor(birthdatespinner,model.toPattern()));
+ birthdatespinner.setForeground(Color.WHITE);
+ birthdatespinner.setBounds(21, 442, 322, 42);
+ getContentPane().add(birthdatespinner);
+
+ JLabel lblGender = new JLabel("Gender");
+ lblGender.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ lblGender.setBounds(362, 414, 134, 29);
+ getContentPane().add(lblGender);
+
+ gendercombo = new JComboBox();
+ gendercombo.setFocusable(false);
+
+ gendercombo.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ gendercombo.setModel(new DefaultComboBoxModel(new String[] {"---Select Gender---", "Male", "Female"}));
+ gendercombo.setBackground(Color.WHITE);
+ gendercombo.setBounds(362, 442, 323, 42);
+ gendercombo.addActionListener(this);
+ getContentPane().add(gendercombo);
+
+ profilepiclabel = new JLabel("");
+ profilepiclabel.setBorder(new LineBorder(Color.GRAY));
+ profilepiclabel.setIcon(new ImageIcon(defaultpicpath));
+ profilepiclabel.setHorizontalAlignment(SwingConstants.CENTER);
+ profilepiclabel.setBounds(21, 507, 100, 120);
+ getContentPane().add(profilepiclabel);
+
+ JLabel lblPhoto = new JLabel("Photo");
+ lblPhoto.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ lblPhoto.setBounds(163, 507, 54, 29);
+ getContentPane().add(lblPhoto);
+
+ filesize = new JLabel("");
+ filesize.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ filesize.setBounds(227, 507, 399, 29);
+ getContentPane().add(filesize);
+
+ choosefilebutton = new JButton("Choose File");
+ choosefilebutton.setFont(new Font("Segoe UI", Font.PLAIN, 15));
+ choosefilebutton.setForeground(Color.BLACK);
+ choosefilebutton.addActionListener(this);
+ choosefilebutton.setFocusable(false);
+ choosefilebutton.setBackground(new Color(245, 245, 245));
+ choosefilebutton.setBounds(161, 547, 114, 35);
+ choosefilebutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ getContentPane().add(choosefilebutton);
+
+ filenamelabel = new JLabel("No File Choosen");
+ filenamelabel.setFont(new Font("Segoe UI", Font.PLAIN, 16));
+ filenamelabel.setBounds(285, 547, 400, 29);
+ getContentPane().add(filenamelabel);
+
+ filesizenote = new JLabel("Imagesize < 1024 KB");
+ filesizenote.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ filesizenote.setBounds(163, 593, 373, 29);
+ getContentPane().add(filesizenote);
+
+ addfacultybutton = new JButton("Add Faculty");
+ addfacultybutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ addfacultybutton.setForeground(new Color(255, 255, 255));
+ addfacultybutton.setBackground(new Color(32, 178, 170));
+ addfacultybutton.setFont(new Font("Segoe UI", Font.BOLD, 16));
+ addfacultybutton.setFocusable(false);
+ addfacultybutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ addfacultybutton.addActionListener(this);
+ addfacultybutton.setBounds(530, 605, 155, 37);
+ getContentPane().add(addfacultybutton);
+
+ Errorlabel = new JLabel("This is required question !");
+ Errorlabel.setForeground(new Color(255, 0, 0));
+ Errorlabel.setFont(new Font("Calibri", Font.PLAIN, 16));
+ Errorlabel.setBounds(21, 127, 322, 17);
+ Errorlabel.setVisible(false);
+ getContentPane().add(Errorlabel);
+
+ }
+ public AddFaculityDialog(FacultyPanel facultypanel)
+ {
+
+ this();
+ this.fp=facultypanel;
+ }
+ public AddFaculityDialog(AdminMain am,Faculty f)
+ {
+ this();
+ this.faculty=f;
+ this.am=am;
+ facultyidfield.setText(f.getFacultyId()+"");
+ facultynamefield.setText(f.getFacultyName());
+ statefield.setText(f.getState());
+ cityfield.setText(f.getCity());
+ emailidfield.setText(f.getEmailId());
+ contactnumberfield.setText(f.getContactNumber());
+ birthdatespinner.setValue(f.getBirthDateInDateFormat());
+ gendercombo.setSelectedItem(f.getGender()+"");
+ experiencefield.setText(f.getExperience());
+ qualificationfield.setText(f.getQualification());
+ profilepiclabel.setIcon(new ImageIcon(f.getProfilePic(100, 120)));
+ headerlabel.setText("Edit Faculty Details");
+ addfacultybutton.setText("Update Faculty");
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ Errorlabel.setVisible(false);
+ if(e.getSource()==choosefilebutton)
+ {
+ FileDialog fd=new FileDialog(this,"Choose a File",FileDialog.LOAD);
+
+ fd.setDirectory(".\\Faculities Profile pic\\");
+ fd.setFile("*.jpeg;*.jpg;*.png;*.tiff;*.tif;*.gif;");
+ fd.setVisible(true);
+ fd.setLocationRelativeTo(this);
+ String filename=fd.getFile();
+ String path=fd.getDirectory();
+
+ if(filename!=null&&!path.isEmpty())
+ {
+
+ file=new File(path+filename);
+ if(file.getAbsolutePath().contains("null"))
+ {
+ file=new File("./assets/profilepicicon.jpg");
+ }
+ long bytes=file.length();
+ if(bytes<10482376)
+ {
+ try
+ {
+ filesizenote.setForeground(new Color(46,139,27));
+ filesizenote.setText("Image size < 1024 KB");
+ Image image = ImageIO.read(file).getScaledInstance(100, 120, Image.SCALE_SMOOTH);
+ profilepiclabel.setIcon(new ImageIcon(image));
+ filesize.setText(file.length()/1024+" KB");
+ filenamelabel.setText(file.getName());
+ }
+ catch(Exception exp)
+ {
+ profilepiclabel.setIcon(new ImageIcon(defaultpicpath));
+ filenamelabel.setText("No file Choosen");
+ filesize.setText("");
+ filesizenote.setForeground(Color.red);
+ filesizenote.setText("Image Not supported");
+ exp.printStackTrace();
+ }
+ }
+ else
+ {
+ filesizenote.setForeground(Color.red);
+ filesizenote.setText("Image size greater than 1024 KB");
+ profilepiclabel.setIcon(new ImageIcon(defaultpicpath));
+ file=new File(defaultpicpath);
+ filesize.setText("");
+ filenamelabel.setText("No File Choosen");
+ }
+
+ }
+ // TODO Auto-generated method stub
+ }
+ if(e.getSource()==addfacultybutton)
+ {
+ if(facultynamefield.getText().isEmpty())
+ {
+ showerror(facultynamefield);
+ }
+ else if(statefield.getText().isEmpty())
+ {
+ showerror(statefield);
+ }
+ else if(cityfield.getText().isEmpty())
+ {
+ showerror(cityfield);
+ }
+ else if(emailidfield.getText().isEmpty())
+ {
+ showerror(emailidfield);
+ }
+ else if(contactnumberfield.getText().isEmpty())
+ {
+ showerror(contactnumberfield);
+ }
+
+ else if(qualificationfield.getText().isEmpty())
+ {
+ showerror(qualificationfield);
+
+ }
+ else if(experiencefield.getText().isEmpty())
+ {
+ showerror(experiencefield);
+ }
+
+ else if(gendercombo.getSelectedIndex()==0)
+ {
+ showerror(gendercombo);
+ }
+ else
+ {
+ try
+ {
+ Faculty f=new Faculty();
+ f.setFacultyId(Integer.parseInt(facultyidfield.getText()));
+ f.setFacultyName(facultynamefield.getText());
+ f.setState(statefield.getText());
+ f.setCity(cityfield.getText());
+ f.setEmailId(emailidfield.getText());
+ f.setContactNumber(contactnumberfield.getText());
+ f.setExperience(experiencefield.getText());
+ f.setQualification(qualificationfield.getText());
+ Date date=(Date) birthdatespinner.getValue();
+ f.setBirthDate(new SimpleDateFormat("dd-MM-yyyy").format(date));
+ f.setGender(gendercombo.getSelectedItem()+"");
+ if(faculty!=null && file.getAbsolutePath().equals("C:\\Users\\Sohansinh Rathod\\eclipse-workspace\\Collage Data Management\\.\\assets\\profilepicicon.jpg"))
+ {
+ f.setProfilePic(faculty.getProfilePic());
+ }
+ else
+ {
+
+ f.setProfilePic(ImageIO.read(file));
+ }
+ int result=0;
+ if(fp!=null)
+ {
+ result=new FacultyData().addFacultyData(f);
+ }
+ else if(am!=null && faculty!=null)
+ {
+ result=new FacultyData().updateFacultyData(faculty, f);
+ }
+ if(result>0)
+ {
+ if(fp!=null)
+ {
+ if(fp.photoviewscrollpane!=null && fp.photoviewscrollpane.isVisible())
+ {
+ fp.createtablemodel();
+ fp.createphotoviewpanel();
+ }
+ else
+ {
+ fp.createtablemodel();
+ }
+ }
+ else if(am!=null && faculty!=null)
+ {
+// Student su=new StudentData().getStudentDetails(s.courcecode, s.sem, s.rollnumber);
+ am.viewfacultypanel.setVisible(false);
+ am.viewfacultypanel=new ViewFacultyPanel(new FacultyData().getFacultyInfobyId(f.getFacultyId()),am,am.viewfacultypanel.lastpanel);
+ am.viewfacultypanel.setVisible(true);
+ am.viewfacultypanel.setLocation(am.panelx, am.panely);
+ am.getContentPane().add(am.viewfacultypanel);
+
+
+
+ }
+ this.dispose();
+
+ }
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ }
+ }
+ }
+
+ public void showerror(JComponent tf)
+ {
+ Errorlabel.setVisible(true);
+ Errorlabel.setBounds(tf.getX(), tf.getY()+tf.getHeight()-5, 400,26);
+ }
+}
diff --git a/src/collegeapplication/faculty/Faculty.java b/src/collegeapplication/faculty/Faculty.java
new file mode 100644
index 0000000..6c9025e
--- /dev/null
+++ b/src/collegeapplication/faculty/Faculty.java
@@ -0,0 +1,92 @@
+package collegeapplication.faculty;
+
+import collegeapplication.common.Person;
+import collegeapplication.common.TimeUtil;
+import collegeapplication.cource.CourceData;
+
+/*
+ * Title : Faculty.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : Binding all the of faculty
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+public class Faculty extends Person
+{
+
+ private int facultyid;
+ private String facultyname;
+ private String qualification;
+ private String experience;
+ private String subject;
+ private String position;
+ private String joineddate;
+
+ public void setJoinedDate(String joineddate)
+ {
+ this.joineddate=joineddate;
+ }
+ public void setFacultyId(int facultyid)
+ {
+ this.facultyid=facultyid;
+ }
+ public void setFacultyName(String facultyname)
+ {
+ this.facultyname=facultyname;
+ }
+ public void setQualification(String qualification)
+ {
+ this.qualification=qualification;
+ }
+ public void setExperience(String experience)
+ {
+ this.experience=experience;
+ }
+ public void setSubject(String subject)
+ {
+ this.subject=subject;
+ }
+ public void setPosition(String position)
+ {
+ this.position=position;
+ }
+ public String getCourceName()
+ {
+ return new CourceData().getcourcename(this.getCourceCode());
+ }
+ public String getFacultyName()
+ {
+ return facultyname;
+ }
+
+ public int getFacultyId()
+ {
+ return facultyid;
+ }
+
+ public String getQualification()
+ {
+ return qualification;
+ }
+ public String getPosition()
+ {
+ return position;
+ }
+ public String getExperience()
+ {
+ return experience;
+ }
+ public String getSubject()
+ {
+ return subject;
+ }
+ public String getJoinedDate()
+ {
+ return joineddate;
+ }
+ public String generateJoinedDate()
+ {
+ joineddate=TimeUtil.getCurrentTime();
+ return joineddate;
+ }
+
+}
\ No newline at end of file
diff --git a/src/collegeapplication/faculty/FacultyData.java b/src/collegeapplication/faculty/FacultyData.java
new file mode 100644
index 0000000..d7157c6
--- /dev/null
+++ b/src/collegeapplication/faculty/FacultyData.java
@@ -0,0 +1,562 @@
+package collegeapplication.faculty;
+
+import java.awt.Image;
+import java.awt.Toolkit;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+
+import javax.swing.JOptionPane;
+
+import collegeapplication.common.DataBaseConnection;
+import collegeapplication.common.Notification;
+import collegeapplication.common.NotificationData;
+import collegeapplication.common.TimeUtil;
+
+/*
+ * Title : FacultyData.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : Handling all the data related to faculty
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+public class FacultyData
+{
+ static Connection con=DataBaseConnection.getConnection();
+ public static void closeConnection()
+ {
+ try {
+ con.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ public int getTotalFaculaty()
+ {
+ int totalf=0;
+ try
+ {
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery("select count(*) from faculties");
+ rs.next();
+ totalf=rs.getInt(1);
+
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ return totalf;
+ }
+ public int getTotalFaculaty(String courcecode,int sem)
+ {
+ int totalf=0;
+ try
+ {
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery("select count(*) from faculties where courcecode='"+courcecode+"' and semoryear="+sem);
+ rs.next();
+ totalf=rs.getInt(1);
+
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ return totalf;
+ }
+ public int getFaculaty(String courcecode,int sem)
+ {
+ int f=0;
+ try
+ {
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery("select count(*) from faculties where courcecode='"+courcecode+"' and semoryear="+sem);
+ rs.next();
+ f=rs.getInt(1);
+
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ return f;
+ }
+ public int createFacultyID()
+ {
+ int id=101;
+ try
+ {
+ java.sql.Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery("select count(*) from faculties");
+ rs.next();
+ id=id+rs.getInt(1);
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return id;
+
+ }
+ public ResultSet getFacultyInfo(String condition)
+ {
+ ResultSet rs=null;
+ try
+ {
+ String query="select facultyid as 'Faculty ID',facultyname as 'Faculty Name',emailid as 'Email ID',qualification as 'Qualification',experience as 'Experience' from faculties "+condition+" order by facultyid";
+ java.sql.Statement st=con.createStatement();
+ rs=st.executeQuery(query);
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return rs;
+ }
+ public ResultSet searchFaculty(String query)
+ {
+ ResultSet rs=null;
+ query+=" order by facultyid";
+ try
+ {
+ java.sql.Statement st=con.createStatement();
+ rs=st.executeQuery(query);
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return rs;
+ }
+ public boolean isActive(String facultyid)
+ {
+ try
+ {
+ String query="select activestatus from faculties where facultyid="+facultyid;
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ return rs.getBoolean(1);
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return false;
+ }
+ public String getFacultyName(String facultyid)
+ {
+ try
+ {
+ String query="select facultyname from faculties where facultyid="+facultyid;
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ return rs.getString(1);
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return "";
+ }
+ public int addFacultyData(Faculty f)
+ {
+ int result=0;
+ String query="insert into faculties values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
+ try
+ {
+ PreparedStatement pr=con.prepareStatement(query);
+ pr.setInt(1, f.getFacultyId());
+ pr.setString(2,f.getFacultyName());
+ pr.setString(3,f.getState());
+ pr.setString(4,f.getCity());
+ pr.setString(5,f.getEmailId());
+ pr.setString(6,f.getContactNumber());
+ pr.setString(7,f.getQualification());
+ pr.setString(8,f.getExperience());
+ pr.setString(9,f.getBirthDate());
+ pr.setString(10,f.getGender());
+ pr.setBytes(11,f.getProfilePicInBytes());
+ pr.setString(12, "Not Assigned");
+ pr.setInt(13, 0);
+ pr.setString(14, "Not Assigned");
+ pr.setString(15, "Not Assigned");
+ pr.setInt(16, 0);
+ pr.setString(17, null);
+ pr.setString(18, f.getBirthDate());
+ pr.setBoolean(19, f.getActiveStatus());
+ pr.setString(20, f.generateJoinedDate());
+ result=pr.executeUpdate();
+ pr.close();
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return result;
+ }
+ public int updateFacultyData(Faculty fold,Faculty f)
+ {
+ int result=0;
+ String query="update faculties set facultyid=? , facultyname=? ,state=? , city=? , emailid=? , contactnumber=? , qualification=? , experience=? , birthdate=? , gender=? , profilepic=?,lastlogin=?,activestatus=? where facultyid="+fold.getFacultyId();
+ try
+ {
+ PreparedStatement pr=con.prepareStatement(query);
+ pr.setInt(1, f.getFacultyId());
+ pr.setString(2,f.getFacultyName());
+ pr.setString(3,f.getState());
+ pr.setString(4,f.getCity());
+ pr.setString(5,f.getEmailId());
+ pr.setString(6,f.getContactNumber());
+ pr.setString(7,f.getQualification());
+ pr.setString(8,f.getExperience());
+ pr.setString(9,f.getBirthDate());
+ pr.setString(10,f.getGender());
+ pr.setBytes(11,f.getProfilePicInBytes());
+ pr.setString(12, f.getLastLogin());
+ pr.setBoolean(13, f.getActiveStatus());
+ result=pr.executeUpdate();
+ pr.close();
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ return result;
+ }
+
+ public Faculty getFacultyInfo(int row)
+ {
+ Faculty f=new Faculty();
+ String query="select * from faculties where sr_no="+row;
+ try
+ {
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ f.setFacultyId(rs.getInt(1));
+ f.setFacultyName(rs.getString(2));
+ f.setState(rs.getString(3));
+ f.setCity(rs.getString(4));
+ f.setEmailId(rs.getString(5));
+ f.setContactNumber(rs.getString(6));
+ f.setQualification(rs.getString(7));
+ f.setExperience(rs.getString(8));
+ f.setBirthDate(rs.getString(9));
+ f.setGender(rs.getString(10));
+ f.setProfilePic(rs.getBytes(11));
+ f.setCourceCode(rs.getString(12));
+ f.setSemorYear(rs.getInt(13));
+ f.setSubject(rs.getString(14));
+ f.setPosition(rs.getString(15));
+ f.setLastLogin(rs.getString(17));
+ f.setPassword(rs.getString(18));
+ f.setActiveStatus(rs.getBoolean(19));
+ f.setJoinedDate(rs.getString(20));
+ st.close();
+
+ return f;
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return f;
+ }
+ public Faculty getFacultyInfobyId(int facultyid)
+ {
+ Faculty f=new Faculty();
+ String query="select * from faculties where facultyid="+facultyid;
+ try
+ {
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ f.setFacultyId(rs.getInt(1));
+ f.setFacultyName(rs.getString(2));
+ f.setState(rs.getString(3));
+ f.setCity(rs.getString(4));
+ f.setEmailId(rs.getString(5));
+ f.setContactNumber(rs.getString(6));
+ f.setQualification(rs.getString(7));
+ f.setExperience(rs.getString(8));
+ f.setBirthDate(rs.getString(9));
+ f.setGender(rs.getString(10));
+ f.setProfilePic(rs.getBytes(11));
+ f.setCourceCode(rs.getString(12));
+ f.setSemorYear(rs.getInt(13));
+ f.setSubject(rs.getString(14));
+ f.setPosition(rs.getString(15));
+ f.setLastLogin(rs.getString(17));
+ f.setPassword(rs.getString(18));
+ f.setActiveStatus(rs.getBoolean(19));
+ f.setJoinedDate(rs.getString(20));
+
+ st.close();
+ return f;
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return f;
+ }
+ public ArrayList getTotalFaculty(String condition)
+ {
+ ArrayList list=new ArrayList();
+
+ String query="select * from faculties"+condition+" order by facultyid asc";
+ try
+ {
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ while(rs.next())
+ {
+ Faculty f=new Faculty();
+ f.setFacultyId(rs.getInt(1));
+ f.setFacultyName(rs.getString(2));
+ f.setState(rs.getString(3));
+ f.setCity(rs.getString(4));
+ f.setEmailId(rs.getString(5));
+ f.setContactNumber(rs.getString(6));
+ f.setQualification(rs.getString(7));
+ f.setExperience(rs.getString(8));
+ f.setBirthDate(rs.getString(9));
+ f.setGender(rs.getString(10));
+ f.setProfilePic(rs.getBytes(11));
+ f.setCourceCode(rs.getString(12));
+ f.setSemorYear(rs.getInt(13));
+ f.setSubject(rs.getString(14));
+ f.setPosition(rs.getString(15));
+ f.setLastLogin(rs.getString(17));
+ f.setPassword(rs.getString(18));
+ f.setActiveStatus(rs.getBoolean(19));
+ f.setJoinedDate(rs.getString(20));
+ list.add(f);
+ }
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return list;
+ }
+
+ public Faculty getFacultyInfobyUserId(String facultyid)
+ {
+ Faculty f=new Faculty();
+ facultyid=facultyid.replaceAll("\\s", "");
+ String query="select * from faculties where facultyid="+facultyid;
+ try
+ {
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ f.setFacultyId(rs.getInt(1));
+ f.setFacultyName(rs.getString(2));
+ f.setState(rs.getString(3));
+ f.setCity(rs.getString(4));
+ f.setEmailId(rs.getString(5));
+ f.setContactNumber(rs.getString(6));
+ f.setQualification(rs.getString(7));
+ f.setExperience(rs.getString(8));
+ f.setBirthDate(rs.getString(9));
+ f.setGender(rs.getString(10));
+ f.setProfilePic(rs.getBytes(11));
+ f.setCourceCode(rs.getString(12));
+ f.setSemorYear(rs.getInt(13));
+ f.setSubject(rs.getString(14));
+ f.setPosition(rs.getString(15));
+ f.setLastLogin(rs.getString(17));
+ f.setPassword(rs.getString(18));
+ f.setActiveStatus(rs.getBoolean(19));
+ f.setJoinedDate(rs.getString(20));
+ st.close();
+ return f;
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return f;
+ }
+
+ public int assignSubject(Faculty fold,Faculty f)
+ {
+ int result=0;
+ try
+ {
+
+ if(!fold.getSubject().equals(f.getSubject())||!fold.getCourceCode().equals(f.getCourceCode())||fold.getSemorYear()!=f.getSemorYear()||!fold.getPosition().equals(f.getPosition()))
+ {
+ this.deleteNotificationHistory(f);
+ Notification n=new Notification();
+ n.setUserProfile("Student");
+ n.setCourceCode(f.getCourceCode());
+ n.setSemorYear(f.getSemorYear());
+ n.setTitle("Subject Faculty");
+ n.setUserId(f.getFacultyId()+"");
+ n.setMessage(f.getFacultyName()+" is your "+f.getSubject()+" subject's new "+f.getPosition()+".");
+ n.setTime(TimeUtil.getCurrentTime());
+ new NotificationData().addNotification(n);
+ n.setMessage(f.getFacultyName()+" is new "+f.getPosition()+" in "+f.getSubject()+" subject.");
+ n.setUserProfile("Faculty");
+ new NotificationData().addNotification(n);
+
+ }
+
+ String query="update faculties set courcecode='"+f.getCourceCode()+"',semoryear="+f.getSemorYear()+",subject='"+f.getSubject()+"',position='"+f.getPosition()+"' where facultyid="+f.getFacultyId();
+ PreparedStatement pr=con.prepareStatement(query);
+ result=pr.executeUpdate();
+ pr.close();
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return result;
+ }
+ public int deleteNotificationHistory(Faculty f)
+ {
+ int result=0;
+ String query="delete from notification where userid='"+f.getFacultyId()+"'";
+ try
+ {
+ PreparedStatement pr=con.prepareStatement(query);
+ result=pr.executeUpdate();
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return result;
+
+ }
+ public ResultSet getFacultySubjectInfo(String condition)
+ {
+ ResultSet rs=null;
+ try
+ {
+ String query="select facultyid as 'Faculty ID',facultyname as 'Faculty Name',courcecode as 'Class',semoryear as 'Sem/Year',subject as 'Subject',position as 'Position' from faculties "+condition+" order by facultyid asc";
+ java.sql.Statement st=con.createStatement();
+ rs=st.executeQuery(query);
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return rs;
+ }
+ public boolean checkPassword(String facultyid,String password)
+ {
+ boolean result=false;
+ try
+ {
+
+ if(facultyid.isEmpty()||facultyid.equalsIgnoreCase(" Enter faculty user-id"))
+ {
+ JOptionPane.showMessageDialog(null, "Incorrect User-Id or Password","Error",JOptionPane.ERROR_MESSAGE);
+ result=false;
+ }
+ else
+ {
+ String query="select count(*) from faculties where facultyid="+facultyid+" and password='"+password+"'";
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ if(rs.getInt(1)>0)
+ {
+ result=true;
+ }
+ else
+ {
+ JOptionPane.showMessageDialog(null, "Incorrect User-Id or Password","Error",JOptionPane.ERROR_MESSAGE);
+ }
+ }
+
+
+ }
+ catch(Exception exp)
+ {
+
+ exp.printStackTrace();
+ }
+ return result;
+ }
+ public void setActiveStatus(boolean activestatus,int facultyid)
+ {
+ try
+ {
+ String query="update faculties set activestatus="+activestatus+" where facultyid="+facultyid;
+ PreparedStatement pr=con.prepareStatement(query);
+ pr.executeUpdate();
+ pr.close();
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ }
+ public String getLastLogin(String userid)
+ {
+ try
+ {
+ String query="select lastlogin from faculties where facultyid="+userid+"";
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ return rs.getString(1);
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return null;
+ }
+ public Image getProfilePic(String userid)
+ {
+ Image image=null;
+ try
+ {
+ String query="select profilepic from faculties where facultyid="+userid;
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ byte[] imagedata=rs.getBytes(1);
+ image=Toolkit.getDefaultToolkit().createImage(imagedata);
+ rs.close();
+ st.close();
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return image;
+ }
+ public int changePassword(String userid,String password)
+ {
+ try
+ {
+ String query="update faculties set password='"+password+"' where facultyid="+userid;
+ PreparedStatement pr=con.prepareStatement(query);
+ return pr.executeUpdate();
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return 0;
+ }
+
+}
+
diff --git a/src/collegeapplication/faculty/FacultyMain.java b/src/collegeapplication/faculty/FacultyMain.java
new file mode 100644
index 0000000..719016a
--- /dev/null
+++ b/src/collegeapplication/faculty/FacultyMain.java
@@ -0,0 +1,689 @@
+package collegeapplication.faculty;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.EventQueue;
+import java.awt.Font;
+import java.awt.Image;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+import java.net.Socket;
+
+import javax.imageio.ImageIO;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.SwingConstants;
+import javax.swing.Timer;
+import javax.swing.UIManager;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.LineBorder;
+import javax.swing.border.MatteBorder;
+import javax.swing.plaf.ColorUIResource;
+
+import collegeapplication.admin.AdminProfilePanel;
+import collegeapplication.chat.ChatData;
+import collegeapplication.chat.ChatMainPanel;
+import collegeapplication.common.DataBaseConnection;
+import collegeapplication.common.HomePanel;
+import collegeapplication.common.NotificationData;
+import collegeapplication.common.NotificationPanel;
+import collegeapplication.common.SearchPanel;
+import collegeapplication.common.TimeUtil;
+import collegeapplication.login.LoginPageFrame;
+import collegeapplication.student.AttandanceReportPanel;
+import collegeapplication.student.EnterMarksPanel;
+import collegeapplication.student.MarkAttandancePanel;
+import collegeapplication.student.MarkSheetPanel;
+import collegeapplication.student.MarkSheetReportPanel;
+import collegeapplication.student.StudentPanel;
+import collegeapplication.student.ViewStudentPanel;
+import collegeapplication.subject.AssignSubjectPanel;
+import collegeapplication.subject.SubjectPanel;
+/*
+ * Title : FacultyMain.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : Main faculty frame
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+@SuppressWarnings("serial")
+public class FacultyMain extends JFrame implements ActionListener
+{
+
+ public JPanel contentPane;
+ private JLabel facultynamelabel;
+ private JLabel facultyprofilepiclabel;
+ private JPanel profilepanel;
+ private JButton homebutton;
+ private JButton studentsbutton;
+ private JButton subjectbutton;
+ private JButton faculitiesbutton;
+ private JButton entermarksbutton;
+ private JButton assignedsubjectbutton;
+ private JButton markattandancebutton;
+ private JButton marksheetreportbutton;
+ private JButton attandancereportbutton;
+ private JButton searchbutton;
+ private JButton notificationbutton;
+ private JButton logoutbutton;
+ private JButton exitbutton;
+ private Color buttonbcolor=Color.DARK_GRAY;
+ private Color buttonfcolor=Color.LIGHT_GRAY;
+ private Font buttonfont=new Font("Tw Cen MT", Font.PLAIN, 20);
+ public SubjectPanel subjectpanel;
+ public HomePanel homepanel;
+ public StudentPanel studentpanel;
+ public ViewStudentPanel viewstudentpanel;
+ public MarkSheetPanel marksheetpanel;
+ public JScrollPane marksheetpanelscroll;
+ public ViewFacultyPanel viewfacultypanel;
+ public AssignSubjectPanel assignsubjectpanel;
+ public EnterMarksPanel entermarkspanel;
+ public JScrollPane entermarkspanelscroll;
+ private MarkAttandancePanel markattandancepanel;
+ private JScrollPane markattandancepanelscroll;
+ public AttandanceReportPanel attandancereportpanel;
+ public JScrollPane attandancereportpanelscroll;
+ public FacultyPanel facultypanel;
+ public AdminProfilePanel adminprofilepanel;
+ public SearchPanel searchpanel;
+ private ChatMainPanel chatmainpanel;
+ public NotificationPanel notificationpanel;
+ public int panely=0,panelx=250;
+ private JButton btn;
+ private JButton myprofilebutton;
+ private String lastlogin;
+ public Faculty f;
+ private int row=63;
+ private JButton chatbutton;
+ public Socket socket;
+ private Timer timer;
+ public MarkSheetReportPanel marksheetreportpanel;
+ public JScrollPane marksheetreportpanelscroll;
+ private JButton contactusbutton;
+ private BufferedImage messagecount;
+ private JLabel totalnewnotification;
+ private JLabel totalnewchatmessage;
+ /**
+ * Launch the application.
+ */
+ public static void main(String[] args) {
+ EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ try {
+
+ if(DataBaseConnection.checkconnection())
+ {
+
+ Faculty f=new FacultyData().getFacultyInfo(1);
+ FacultyMain frame = new FacultyMain(f);
+ frame.setVisible(true);
+
+ }
+ else
+ {
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ JOptionPane.showMessageDialog(null, "You Are Not Connected To DataBase","Error",JOptionPane.ERROR_MESSAGE);
+
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ }
+
+ /**
+ * Create the frame.
+ */
+ public FacultyMain(Faculty f) {
+ this.f=f;
+ ActionListener setActive=new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ // TODO Auto-generated method stub
+ new FacultyData().setActiveStatus(true, f.getFacultyId());
+ int notification=new NotificationData().getUnreadNotification(f.getFacultyId()+"", "Faculty", f.getCourceCode(), f.getSemorYear(),f.getJoinedDate());
+ if(notification>0)
+ {
+ totalnewnotification.setVisible(true);
+ totalnewnotification.setText(notification>999?"999+":notification+"");
+ totalnewnotification.setIcon(new ImageIcon(messagecount.getScaledInstance(24+totalnewnotification.getText().length(), 24, Image.SCALE_SMOOTH)));
+ }
+ int chat=new ChatData().getUndreadMessageCountFaculty(f);
+ if(chat>0)
+ {
+ totalnewchatmessage.setText(chat>999?"999+":chat+"");
+ totalnewchatmessage.setVisible(true);
+ totalnewchatmessage.setIcon(new ImageIcon(messagecount.getScaledInstance(26+totalnewchatmessage.getText().length(), 26, Image.SCALE_SMOOTH)));
+ }
+ else if(chat==0)
+ {
+ totalnewchatmessage.setVisible(false);
+ }
+ }
+
+ };
+ timer=new Timer(1000,setActive);
+ timer.start();
+ Color bgColor =new Color(32,178,170);
+ Color frColor=Color.white;
+ try
+ {
+ messagecount=ImageIO.read(new File("./assets/messagecount.png"));
+ }
+ catch(IOException exp)
+ {
+ exp.printStackTrace();
+ }
+ UIManager.put("ComboBoxUI", "com.sun.java.swing.plaf.windows.WindowsComboBoxUI");
+ UIManager.put("ComboBox.selectionBackground", new ColorUIResource(bgColor));
+ UIManager.put("ComboBox.background", new ColorUIResource(Color.white));
+ UIManager.put("ComboBox.foreground", new ColorUIResource(Color.DARK_GRAY));
+ UIManager.put("ComboBox.selectionForeground", new ColorUIResource(frColor));
+ UIManager.put("ScrollBarUI", "com.sun.java.swing.plaf.windows.WindowsScrollBarUI");
+
+ this.setResizable(false);
+ setTitle("Collage Data Management");
+ setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
+ contentPane = new JPanel();
+ contentPane.setForeground(Color.DARK_GRAY);
+ contentPane.setBackground(Color.DARK_GRAY);
+ contentPane.setBorder(new EmptyBorder(0, 0, 0, 0));
+ setContentPane(contentPane);
+ contentPane.setLayout(null);
+
+ this.setBounds(-2,0,1370,733);
+ createpanel();
+ JPanel sidebarpanel = new JPanel();
+ sidebarpanel.setBorder(new MatteBorder(0, 0, 0, 2, (Color) new Color(64, 64, 64)));
+ sidebarpanel.setBackground(Color.DARK_GRAY);
+ sidebarpanel.setBounds(5, 11, 240, 706);
+ contentPane.add(sidebarpanel);
+ sidebarpanel.setLayout(null);
+
+ profilepanel = new JPanel();
+ profilepanel.setBorder(new MatteBorder(0, 0, 2, 0, (Color) Color.LIGHT_GRAY));
+ profilepanel.setBackground(Color.DARK_GRAY);
+ profilepanel.setBounds(0, 0, 240, 61);
+ sidebarpanel.add(profilepanel);
+ profilepanel.setLayout(null);
+
+ facultynamelabel = new JLabel();
+ facultynamelabel.setForeground(Color.WHITE);
+ facultynamelabel.setHorizontalAlignment(SwingConstants.LEFT);
+ facultynamelabel.setFont(new Font("Tw Cen MT", Font.BOLD, 25));
+ facultynamelabel.setBackground(Color.DARK_GRAY);
+ facultynamelabel.setOpaque(true);
+ facultynamelabel.setBounds(65, 5, 171, 36);
+ profilepanel.add(facultynamelabel);
+
+ facultyprofilepiclabel = new JLabel();
+ facultyprofilepiclabel.setBounds(5,0, 50, 50);
+ profilepanel.add(facultyprofilepiclabel);
+ facultyprofilepiclabel.setHorizontalAlignment(SwingConstants.CENTER);
+ facultyprofilepiclabel.setBackground(Color.DARK_GRAY);
+
+ facultyprofilepiclabel.setBorder(new LineBorder(Color.black,0));
+ facultyprofilepiclabel.setOpaque(true);
+
+
+
+
+ homebutton = createButton("Home");
+ sidebarpanel.add(homebutton);
+ btn=homebutton;
+
+ studentsbutton = createButton("Students");
+ sidebarpanel.add(studentsbutton);
+
+ subjectbutton = createButton("Subjects");
+ sidebarpanel.add(subjectbutton);
+
+ faculitiesbutton =createButton("Co-Faculities","Faculities");
+ sidebarpanel.add(faculitiesbutton);
+
+ assignedsubjectbutton =createButton("Assigned Subject","Assign Subject");
+ sidebarpanel.add(assignedsubjectbutton);
+
+ entermarksbutton = createButton("Enter Marks");
+ sidebarpanel.add(entermarksbutton);
+
+ marksheetreportbutton=createButton("Marksheet Report");
+ sidebarpanel.add(marksheetreportbutton);
+
+ markattandancebutton = createButton("Mark Attandance");
+ sidebarpanel.add(markattandancebutton);
+
+ attandancereportbutton = createButton("Attandance Report");
+ sidebarpanel.add(attandancereportbutton);
+
+ chatbutton = createButton("Chat");
+ chatbutton.setLayout(new BorderLayout());
+ sidebarpanel.add(chatbutton);
+ int chat=new ChatData().getUndreadMessageCountFaculty(f);
+ totalnewchatmessage=new JLabel();
+ totalnewchatmessage.setSize(60,30);
+ totalnewchatmessage.setFont(new Font("Arial",Font.BOLD,12));
+ totalnewchatmessage.setForeground(Color.white);
+ totalnewchatmessage.setHorizontalTextPosition(JLabel.CENTER);
+ totalnewchatmessage.setVerticalTextPosition(JLabel.CENTER);
+ chatbutton.add(totalnewchatmessage,BorderLayout.LINE_END);
+ if(chat>0)
+ {
+ totalnewchatmessage.setText(chat>999?"999+":chat+"");
+ totalnewchatmessage.setVisible(true);
+ totalnewchatmessage.setIcon(new ImageIcon(messagecount.getScaledInstance(26+totalnewchatmessage.getText().length(), 26, Image.SCALE_SMOOTH)));
+ }
+
+ searchbutton = createButton("Search");
+ sidebarpanel.add(searchbutton);
+
+ notificationbutton =createButton("Notification");
+ notificationbutton.setLayout(new BorderLayout());
+ sidebarpanel.add(notificationbutton);
+
+ totalnewnotification=new JLabel();
+ totalnewnotification.setSize(60,30);
+ totalnewnotification.setFont(new Font("Arial",Font.BOLD,12));
+ totalnewnotification.setForeground(Color.white);
+ totalnewnotification.setHorizontalTextPosition(JLabel.CENTER);
+ totalnewnotification.setVerticalTextPosition(JLabel.CENTER);
+ notificationbutton.add(totalnewnotification,BorderLayout.LINE_END);
+ int notification=new NotificationData().getUnreadNotification(f.getFacultyId()+"", "Faculty", f.getCourceCode(), f.getSemorYear(),f.getJoinedDate());
+ System.out.println("Notification :"+notification);
+ if(notification>0)
+ {
+ totalnewnotification.setText(notification>999?"999+":notification+"");
+ totalnewnotification.setIcon(new ImageIcon(messagecount.getScaledInstance(26+totalnewnotification.getText().length(), 26, Image.SCALE_SMOOTH)));
+ }
+
+
+ myprofilebutton = createButton("My Profile","Profile");
+ sidebarpanel.add(myprofilebutton);
+
+ contactusbutton= createButton("Contact Us");
+ sidebarpanel.add(contactusbutton);
+
+ logoutbutton = createButton("logout");
+ sidebarpanel.add(logoutbutton);
+
+ exitbutton =createButton("Exit");
+ sidebarpanel.add(exitbutton);
+
+ activeButton(homebutton);
+ homepanel.setVisible(true);
+
+
+
+ this.setFacultyDetails();
+ lastlogin=f.getLastLogin();
+ homepanel.setLastLogin(lastlogin);
+ f.setLastLogin(TimeUtil.getCurrentTime());
+ f.setActiveStatus(true);
+ new FacultyData().updateFacultyData(f, f);
+
+
+
+ this.addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowClosing(final WindowEvent windowenent) {
+ openPanel(exitbutton);
+ }
+ });
+
+
+
+ }
+ public void createpanel()
+ {
+
+ homepanel=new HomePanel(f);
+ homepanel.setLocation(panelx,panely);
+ homepanel.setVisible(true);
+ homepanel.setFocusable(true);
+ contentPane.add(homepanel);
+
+ }
+
+ public void activeButton(JButton button)
+ {
+ btn.setBackground(buttonbcolor);
+ btn.setForeground(buttonfcolor);
+ btn.setFont(buttonfont);
+ btn.setDisabledIcon(new ImageIcon(""));
+ btn.setIcon(new ImageIcon("./assets/"+btn.getName()+"dac.png"));
+ btn=button;
+ btn.setForeground(Color.white);
+ btn.setFont(new Font("Tw Cen MT", Font.BOLD, 23));
+ btn.setIcon(new ImageIcon("./assets/"+btn.getName()+"ac.png"));
+ disablepanel();
+ }
+
+ public JButton createButton(String text,String name)
+ {
+ JButton button=createButton(text);
+ button.setName(name);
+ button.setIcon(new ImageIcon("./assets/"+button.getName()+"dac.png"));
+ return button;
+ }
+ public JButton createButton(String text)
+ {
+ JButton button=new JButton();
+ button.setForeground(buttonfcolor);
+ button.setFont(buttonfont);
+ button.setBackground(buttonbcolor);
+ button.setHorizontalAlignment(SwingConstants.LEFT);
+ button.setFocusable(false);
+ button.setContentAreaFilled(false);
+ button.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ button.setBorder(new EmptyBorder(0,0,0,0));
+ button.setText(text);
+ button.setName(text);
+ button.setIcon(new ImageIcon("./assets/"+button.getName()+"dac.png"));
+ button.addActionListener(this);
+ button.setIconTextGap(10);
+ button.setLocation(0, row);
+ button.setSize(234, 40);
+ row+=39;
+ return button;
+ }
+ public void disablepanel()
+ {
+ if(homepanel!=null && homepanel.isVisible())
+ {
+ homepanel.setVisible(false);
+ }
+ else if(subjectpanel!=null&&subjectpanel.isVisible())
+ {
+ subjectpanel.setVisible(false);
+ }
+ else if(studentpanel!=null&&studentpanel.isVisible())
+ {
+ studentpanel.setVisible(false);
+ }
+ else if(viewstudentpanel!=null && viewstudentpanel.isVisible())
+ {
+
+ viewstudentpanel.setVisible(false);
+ }
+ else if(facultypanel!=null && facultypanel.isVisible())
+ {
+ facultypanel.setVisible(false);
+ }
+ else if(viewfacultypanel!=null&&viewfacultypanel.isVisible())
+ {
+ viewfacultypanel.setVisible(false);
+ }
+ else if(assignsubjectpanel!=null &&assignsubjectpanel.isVisible())
+ {
+ assignsubjectpanel.setVisible(false);
+ }
+ else if(entermarkspanelscroll!=null && entermarkspanelscroll.isVisible())
+ {
+ entermarkspanelscroll.setVisible(false);
+ }
+ else if(marksheetpanelscroll!=null&& marksheetpanelscroll.isVisible())
+ {
+ marksheetpanelscroll.setVisible(false);
+ }
+ else if(markattandancepanelscroll!=null && markattandancepanelscroll.isVisible())
+ {
+ markattandancepanelscroll.setVisible(false);
+ }
+ else if(marksheetreportpanelscroll!=null && marksheetreportpanelscroll.isVisible())
+ {
+ marksheetreportpanelscroll.setVisible(false);
+ }
+ else if(attandancereportpanelscroll!=null && attandancereportpanelscroll.isVisible())
+ {
+ attandancereportpanelscroll.setVisible(false);
+ }
+ else if(notificationpanel!=null && notificationpanel.isVisible())
+ {
+ notificationpanel.setVisible(false);
+ }
+ else if(adminprofilepanel!=null && adminprofilepanel.isVisible())
+ {
+ adminprofilepanel.setVisible(false);
+ }
+ else if(searchpanel!=null && searchpanel.isVisible())
+ {
+ searchpanel.setVisible(false);
+ }
+ else if(chatmainpanel!=null && chatmainpanel.isVisible())
+ {
+ try {
+ if(chatmainpanel.chatpanel.subchatpanel!=null&&chatmainpanel.chatpanel.subchatpanel.socket!=null&&!chatmainpanel.chatpanel.subchatpanel.socket.isClosed())
+ {
+ chatmainpanel.chatpanel.subchatpanel.socket.close();
+ }
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ chatmainpanel.setVisible(false);
+ }
+ }
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ this.openPanel(e.getSource());
+ }
+ public void openPanel(Object source)
+ {
+ if(source==homebutton)
+ {
+ activeButton(homebutton);
+ homepanel=new HomePanel(f);
+ homepanel.setLocation(panelx, panely);
+ homepanel.setFocusable(true);
+ contentPane.add(homepanel);
+ homepanel.setLastLogin(lastlogin);
+ homepanel.setVisible(true);
+
+ }
+
+ else if(source==subjectbutton)
+ {
+ activeButton(subjectbutton);
+ subjectpanel=new SubjectPanel(this);
+ subjectpanel.setLocation(panelx, panely);
+ subjectpanel.setFocusable(true);
+ contentPane.add(subjectpanel);
+ subjectpanel.setVisible(true);
+ }
+ else if(source==studentsbutton)
+ {
+ activeButton(studentsbutton);
+ studentpanel=new StudentPanel(this);
+ studentpanel.setLocation(panelx,panely);
+ studentpanel.setVisible(true);
+ studentpanel.setFocusable(true);
+ contentPane.add(studentpanel);
+ }
+ else if(source==faculitiesbutton)
+ {
+ activeButton(faculitiesbutton);
+ facultypanel=new FacultyPanel(this);
+ facultypanel.setLocation(panelx,panely);
+ facultypanel.setVisible(true);
+ facultypanel.setFocusable(true);
+ contentPane.add(facultypanel);
+
+ }
+ else if(source==assignedsubjectbutton)
+ {
+ activeButton(assignedsubjectbutton);
+ assignsubjectpanel=new AssignSubjectPanel(this);
+ assignsubjectpanel.setLocation(panelx,panely);
+ assignsubjectpanel.setVisible(true);
+ assignsubjectpanel.setFocusable(true);
+ contentPane.add(assignsubjectpanel);
+
+ }
+ else if(source==entermarksbutton)
+ {
+
+ activeButton(entermarksbutton);
+ entermarkspanel=new EnterMarksPanel(this);
+ entermarkspanel.setVisible(true);
+ entermarkspanelscroll=new JScrollPane(entermarkspanel,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ entermarkspanelscroll.setBounds(panelx,panely,1116,705);
+ entermarkspanelscroll.setVisible(true);
+ entermarkspanelscroll.getVerticalScrollBar().setUnitIncrement(16);
+ contentPane.add(entermarkspanelscroll);
+ for(Component c:entermarkspanelscroll.getComponents())
+ {
+ c.setBackground(Color.white);
+ }
+
+ }
+ else if(source==marksheetreportbutton)
+ {
+ activeButton(marksheetreportbutton);
+ marksheetreportpanel=new MarkSheetReportPanel(this);
+ marksheetreportpanel.setVisible(true);
+ marksheetreportpanelscroll=new JScrollPane(marksheetreportpanel,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ marksheetreportpanelscroll.setBounds(panelx, panely, 1116, 705);
+ marksheetreportpanelscroll.setVisible(true);
+ marksheetreportpanelscroll.setName("Marksheet Report Panel Scroll");
+ marksheetreportpanelscroll.getVerticalScrollBar().setUnitIncrement(80);
+ contentPane.add(marksheetreportpanelscroll);
+ for(Component c:marksheetreportpanelscroll.getComponents())
+ {
+ c.setBackground(Color.white);
+ }
+ }
+ else if(source==markattandancebutton)
+ {
+ activeButton(markattandancebutton);
+ markattandancepanel=new MarkAttandancePanel(this);
+ markattandancepanel.setVisible(true);
+ markattandancepanelscroll=new JScrollPane(markattandancepanel,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ markattandancepanelscroll.setBounds(panelx, panely, 1116, 705);
+ markattandancepanelscroll.setVisible(true);
+ markattandancepanelscroll.getVerticalScrollBar().setUnitIncrement(16);
+ contentPane.add(markattandancepanelscroll);
+ for(Component c:markattandancepanelscroll.getComponents())
+ {
+ c.setBackground(Color.white);
+ }
+ }
+ else if(source==attandancereportbutton)
+ {
+ activeButton(attandancereportbutton);
+ attandancereportpanel=new AttandanceReportPanel(this);
+ attandancereportpanel.setVisible(true);
+ attandancereportpanelscroll=new JScrollPane(attandancereportpanel,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ attandancereportpanelscroll.setBounds(panelx, panely, 1116, 705);
+ attandancereportpanelscroll.setVisible(true);
+ attandancereportpanelscroll.setName("Attadance Report Panel Scroll");
+ attandancereportpanelscroll.getVerticalScrollBar().setUnitIncrement(16);
+ contentPane.add(attandancereportpanelscroll);
+ for(Component c:attandancereportpanelscroll.getComponents())
+ {
+ c.setBackground(Color.white);
+ }
+ }
+ else if(source==chatbutton)
+ {
+ activeButton(chatbutton);
+ chatmainpanel=new ChatMainPanel(this);
+ chatmainpanel.setLocation(this.panelx, this.panely);
+ chatmainpanel.setVisible(true);
+ contentPane.add(chatmainpanel);
+
+ }
+ else if(source==searchbutton)
+ {
+ activeButton(searchbutton);
+ searchpanel=new SearchPanel(this);
+ searchpanel.setLocation(this.panelx, this.panely);
+ searchpanel.setVisible(true);
+ contentPane.add(searchpanel);
+
+ }
+ else if(source==notificationbutton)
+ {
+ activeButton(notificationbutton);
+ if(totalnewnotification!=null && totalnewnotification.isVisible())
+ {
+ totalnewnotification.setVisible(false);
+ }
+ notificationpanel=new NotificationPanel(this);
+ notificationpanel.setLocation(panelx,panely);
+ notificationpanel.setVisible(true);
+ notificationpanel.setFocusable(true);
+ contentPane.add(notificationpanel);
+
+ }
+ else if(source==contactusbutton)
+ {
+ activeButton(contactusbutton);
+ adminprofilepanel=new AdminProfilePanel();
+ adminprofilepanel.setLocation(panelx,panely);
+ adminprofilepanel.setVisible(true);
+ adminprofilepanel.setFocusable(true);
+ contentPane.add(adminprofilepanel);
+ }
+ else if(source==myprofilebutton)
+ {
+ activeButton(myprofilebutton);
+ viewfacultypanel=new ViewFacultyPanel(f,this);
+ viewfacultypanel.setLocation(panelx,panely);
+ viewfacultypanel.setVisible(true);
+ viewfacultypanel.setFocusable(true);
+ contentPane.add(viewfacultypanel);
+ }
+ else if(source==exitbutton)
+ {
+ int result=JOptionPane.showConfirmDialog(null,"Do you want to exit this application ?","Exit",JOptionPane.INFORMATION_MESSAGE);
+ if(result==JOptionPane.YES_OPTION)
+ {
+ f.setActiveStatus(false);
+ timer.stop();
+ new FacultyData().setActiveStatus(false, f.getFacultyId());
+ disablepanel();
+ System.exit(0);
+ }
+ }
+ else if(source==logoutbutton)
+ {
+ int result=JOptionPane.showConfirmDialog(null,"Do you want to logout this application ?","Logout",JOptionPane.INFORMATION_MESSAGE);
+ if(result==JOptionPane.YES_OPTION)
+ {
+ f.setActiveStatus(false);
+ timer.stop();
+ new FacultyData().setActiveStatus(false, f.getFacultyId());
+ LoginPageFrame loginpageframe=new LoginPageFrame();
+ loginpageframe.setVisible(true);
+ loginpageframe.setLocationRelativeTo(null);
+ disablepanel();
+ this.dispose();
+ }
+ }
+
+ }
+
+
+ public void setFacultyDetails()
+ {
+ facultyprofilepiclabel.setIcon(new ImageIcon(f.getRoundedProfilePic(50, 50, 50)));
+ facultynamelabel.setText(f.getFacultyName());
+ }
+
+}
diff --git a/src/collegeapplication/faculty/FacultyPanel.java b/src/collegeapplication/faculty/FacultyPanel.java
new file mode 100644
index 0000000..862519e
--- /dev/null
+++ b/src/collegeapplication/faculty/FacultyPanel.java
@@ -0,0 +1,349 @@
+package collegeapplication.faculty;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.sql.ResultSet;
+
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFormattedTextField;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JSpinner;
+import javax.swing.JTable;
+import javax.swing.SpinnerNumberModel;
+import javax.swing.SwingConstants;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.LineBorder;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.table.DefaultTableCellRenderer;
+import javax.swing.text.DefaultFormatter;
+
+import collegeapplication.admin.AdminMain;
+import collegeapplication.common.PhotoViewPanel;
+import collegeapplication.student.StudentMain;
+import net.proteanit.sql.DbUtils;
+
+/*
+ * Title : FacultyPanel.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : To display all faculty in table or photoview
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+@SuppressWarnings("serial")
+public class FacultyPanel extends JPanel implements ActionListener {
+ private JButton addnewfaculity;
+ public JButton viewbutton;
+ public JTable table;
+ public AdminMain am;
+ public JPanel tableviewpanel;
+ public JScrollPane photoviewscrollpane;
+ private JLabel maxphotolabel;
+ private JSpinner maxphotospinner;
+ int maxphoto=4;
+ public StudentMain sm;
+ public FacultyMain fm;
+ private String condition="";
+ private JLabel headinglabel;
+
+ /**
+ * Create the panel.
+ * @param am
+ */
+ public FacultyPanel(AdminMain am)
+ {
+ this();
+ this.am=am;
+ table.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ if(e.getClickCount()>1 && e.getButton()==MouseEvent.BUTTON1)
+ {
+ JTable t=(JTable) e.getSource();
+ int fid=Integer.parseInt(t.getValueAt(t.getSelectedRow(), 0)+"");
+ Faculty f=new FacultyData().getFacultyInfobyId(fid);
+
+ am.viewfacultypanel=new ViewFacultyPanel(f,am,am.facultypanel);
+ am.viewfacultypanel.setVisible(true);
+ am.facultypanel.setVisible(false);
+ am.viewfacultypanel.setLocation(am.panelx,am.panely);
+ am.viewfacultypanel.setVisible(true);
+ am.viewfacultypanel.setFocusable(true);
+ am.contentPane.add(am.viewfacultypanel);
+
+ }
+
+ }
+ });
+ }
+ public FacultyPanel(FacultyMain fm)
+ {
+ this();
+ this.fm=fm;
+ headinglabel.setText("Co-Faculties");
+ this.addnewfaculity.setVisible(false);
+ this.viewbutton.setLocation(addnewfaculity.getX(), addnewfaculity.getY());
+ condition=" where courcecode='"+fm.f.getCourceCode()+"' and semoryear="+fm.f.getSemorYear()+" and facultyid!="+fm.f.getFacultyId();
+ this.createtablemodel();
+ table.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ if(e.getClickCount()>1 && e.getButton()==MouseEvent.BUTTON1)
+ {
+ JTable t=(JTable) e.getSource();
+ int fid=Integer.parseInt(t.getValueAt(t.getSelectedRow(), 0)+"");
+ Faculty f=new FacultyData().getFacultyInfobyId(fid);
+
+ fm.viewfacultypanel=new ViewFacultyPanel(f,fm,fm.facultypanel);
+ fm.viewfacultypanel.setVisible(true);
+ fm.facultypanel.setVisible(false);
+ fm.viewfacultypanel.setLocation(fm.panelx,fm.panely);
+ fm.viewfacultypanel.setVisible(true);
+ fm.viewfacultypanel.setFocusable(true);
+ fm.contentPane.add(fm.viewfacultypanel);
+
+ }
+
+ }
+ });
+ }
+ /**
+ * @param sm
+ */
+ public FacultyPanel(StudentMain sm)
+ {
+ this();
+ this.sm=sm;
+ headinglabel.setText("Faculties");
+ this.addnewfaculity.setVisible(false);
+ this.viewbutton.setLocation(addnewfaculity.getX(), addnewfaculity.getY());
+ condition=" where courcecode='"+sm.s.getCourceCode()+"' and semoryear="+sm.s.getSemorYear()+" ";
+ this.createtablemodel();
+ table.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ if(e.getClickCount()>1 && e.getButton()==MouseEvent.BUTTON1)
+ {
+ JTable t=(JTable) e.getSource();
+ int fid=Integer.parseInt(t.getValueAt(t.getSelectedRow(), 0)+"");
+ Faculty f=new FacultyData().getFacultyInfobyId(fid);
+
+ sm.viewfacultypanel=new ViewFacultyPanel(f,sm,sm.facultypanel);
+ sm.viewfacultypanel.setVisible(true);
+ sm.facultypanel.setVisible(false);
+ sm.viewfacultypanel.setLocation(sm.panelx,sm.panely);
+ sm.viewfacultypanel.setVisible(true);
+ sm.viewfacultypanel.setFocusable(true);
+ sm.contentPane.add(sm.viewfacultypanel);
+
+ }
+
+ }
+ });
+ }
+
+ private FacultyPanel() {
+ this.setName("Faculty Panel");
+ setBackground(Color.WHITE);
+ this.setSize(1116, 705);
+ setLayout(null);
+ JPanel panel = new JPanel();
+ panel.setBackground(new Color(32, 178, 170));
+ panel.setBounds(10, 0, 1096, 183);
+ add(panel);
+ panel.setLayout(null);
+ headinglabel = new JLabel("All Faculities");
+ headinglabel.setIcon(null);
+ headinglabel.setBounds(10, 65, 272, 44);
+ panel.add(headinglabel);
+ headinglabel.setBackground(new Color(32, 178, 170));
+ headinglabel.setHorizontalAlignment(SwingConstants.LEFT);
+ headinglabel.setForeground(Color.WHITE);
+ headinglabel.setFont(new Font("Segoe UI", Font.BOLD, 30));
+ headinglabel.setOpaque(true);
+
+ addnewfaculity = new JButton("Add Faculity");
+ addnewfaculity.setBorder(new EmptyBorder(0, 0, 0, 0));
+ addnewfaculity.setBounds(932, 139, 153, 33);
+ panel.add(addnewfaculity);
+ addnewfaculity.setFocusable(false);
+ addnewfaculity.setForeground(new Color(0, 128, 128));
+ addnewfaculity.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ addnewfaculity.setCursor(new Cursor(Cursor.HAND_CURSOR));
+
+ addnewfaculity.setBackground(new Color(255, 255, 255));
+
+ viewbutton = new JButton("Photo View");
+ viewbutton.setForeground(new Color(0, 128, 128));
+ viewbutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ viewbutton.setFocusable(false);
+ viewbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ viewbutton.setBackground(Color.WHITE);
+ viewbutton.setBounds(769, 139, 153, 33);
+
+ viewbutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ viewbutton.addActionListener(this);
+ panel.add(viewbutton);
+
+ maxphotospinner = new JSpinner();
+ maxphotospinner.setForeground(new Color(255, 255, 255));
+ maxphotospinner.setBackground(new Color(255, 255, 255));
+
+ maxphotospinner.setVerifyInputWhenFocusTarget(false);
+ maxphotospinner.setModel(new SpinnerNumberModel(4, 1, 12, 1));
+ maxphotospinner.setFont(new Font("Tahoma", Font.PLAIN, 17));
+ JComponent comp = maxphotospinner.getEditor();
+ JFormattedTextField field = (JFormattedTextField) comp.getComponent(0);
+ field.setFocusable(false);
+ DefaultFormatter formatter = (DefaultFormatter) field.getFormatter();
+ formatter.setCommitsOnValidEdit(true);
+ maxphotospinner.addChangeListener(new ChangeListener() {
+
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ maxphoto=(int) maxphotospinner.getValue();
+ createphotoviewpanel();
+ }
+ });
+ maxphotospinner.setBounds(1000, 83, 85, 33);
+ maxphotospinner.setVisible(false);
+ maxphotospinner.setFocusable(false);
+ panel.add(maxphotospinner);
+
+ maxphotolabel = new JLabel("Max Photos in Row ");
+ maxphotolabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ maxphotolabel.setForeground(Color.WHITE);
+ maxphotolabel.setFont(new Font("Segoe UI", Font.BOLD, 17));
+ maxphotolabel.setBounds(793, 83, 197, 33);
+ panel.add(maxphotolabel);
+ maxphotolabel.setVisible(false);
+
+ addnewfaculity.addActionListener(this);
+
+ tableviewpanel = new JPanel();
+ tableviewpanel.setBackground(Color.WHITE);
+ tableviewpanel.setBounds(0, 189, 1116, 528);
+ add(tableviewpanel);
+ tableviewpanel.setLayout(null);
+
+ JScrollPane scrollPane = new JScrollPane();
+ scrollPane.setBounds(10, 11, 1095, 483);
+ scrollPane.setBorder(new EmptyBorder(0, 0, 0, 0));
+ for(Component c : scrollPane.getComponents())
+ {
+ c.setBackground(Color.white);
+ }
+ tableviewpanel.add(scrollPane);
+
+ table = new JTable();
+
+ table = new JTable();
+ table.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ table.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ table.getTableHeader().setBackground(new Color(32,178,170));
+ table.getTableHeader().setForeground(Color.white);
+ table.getTableHeader().setFont(new Font("Arial",Font.BOLD,20));
+ table.setFont(new Font("Segoe UI",Font.PLAIN,20));
+ table.getTableHeader().setPreferredSize(new Dimension(50,40));
+ table.setDragEnabled(false);
+ table.setRowHeight(40);
+ createtablemodel();
+ table.setSelectionBackground(new Color(240, 255, 255));
+ table.setFocusable(false);
+ table.setDefaultEditor(Object.class,null);
+ table.setGridColor(Color.LIGHT_GRAY);
+ table.getTableHeader().setReorderingAllowed(false);
+ scrollPane.setViewportView(table);
+
+
+
+ }
+
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+
+ // TODO Auto-generated method stub
+ if(e.getSource()==addnewfaculity)
+ {
+ AddFaculityDialog afd=new AddFaculityDialog(this);
+ afd.setLocationRelativeTo(null);
+ afd.setVisible(true);
+ }
+ if(e.getSource()==viewbutton && viewbutton.getText().equals("Photo View"))
+ {
+ createphotoviewpanel();
+
+ }
+ else if(e.getSource()==viewbutton && viewbutton.getText().equals("Table View"))
+ {
+ if(photoviewscrollpane!=null)
+ {
+ photoviewscrollpane.setVisible(false);
+ }
+ createtablemodel();
+ tableviewpanel.setVisible(true);
+ viewbutton.setText("Photo View");
+
+ }
+
+ if(photoviewscrollpane!=null && photoviewscrollpane.isVisible()) {
+ maxphotolabel.setVisible(true);
+ maxphotospinner.setVisible(true);
+ }
+ else
+ {
+ maxphotolabel.setVisible(false);
+ maxphotospinner.setVisible(false);
+ }
+ }
+ public void createphotoviewpanel()
+ {
+ if(this.photoviewscrollpane!=null)
+ {
+ this.photoviewscrollpane.setVisible(false);
+ }
+ this.tableviewpanel.setVisible(false);
+ PhotoViewPanel photoviewpanel=new PhotoViewPanel(this,maxphoto);
+ photoviewpanel.setVisible(true);
+ this.photoviewscrollpane=new JScrollPane(photoviewpanel,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ this.photoviewscrollpane.getVerticalScrollBar().setUnitIncrement(16);
+ this.photoviewscrollpane.setBounds(0, 189, 1105, 500);
+ this.photoviewscrollpane.setVisible(true);
+ this.add(photoviewscrollpane);
+ this.photoviewscrollpane.setBorder(new EmptyBorder(0,0,0,0));
+ viewbutton.setText("Table View");
+
+ }
+ public void createtablemodel()
+ {
+ ResultSet rs=new FacultyData().getFacultyInfo(condition);
+ if(rs!=null)
+ {
+ table.setModel(DbUtils.resultSetToTableModel(rs));
+ }
+ table.getColumnModel().getColumn(0).setMaxWidth(200);
+ table.getColumnModel().getColumn(1).setMaxWidth(300);
+ table.getColumnModel().getColumn(2).setMaxWidth(500);
+ table.getColumnModel().getColumn(3).setMaxWidth(250);
+ table.getColumnModel().getColumn(4).setMaxWidth(250);
+ table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
+ DefaultTableCellRenderer cellrenderer=new DefaultTableCellRenderer();
+ cellrenderer.setHorizontalAlignment(JLabel.CENTER);
+ table.getColumnModel().getColumn(0).setCellRenderer(cellrenderer);
+ }
+
+}
diff --git a/src/collegeapplication/faculty/ViewFacultyPanel.java b/src/collegeapplication/faculty/ViewFacultyPanel.java
new file mode 100644
index 0000000..cf19d2b
--- /dev/null
+++ b/src/collegeapplication/faculty/ViewFacultyPanel.java
@@ -0,0 +1,561 @@
+package collegeapplication.faculty;
+
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingConstants;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.LineBorder;
+
+import collegeapplication.admin.AdminMain;
+import collegeapplication.common.ChangePasswordDialog;
+import collegeapplication.cource.CourceData;
+import collegeapplication.student.StudentMain;
+import collegeapplication.subject.AssignSubjectDialog;
+
+/*
+ * Title : ViewFacultyPanel.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : Displaying all the details of faculty
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+@SuppressWarnings("serial")
+public class ViewFacultyPanel extends JPanel {
+
+ /**
+ * Create the panel.
+ */
+ public JComponent lastpanel;
+ private JButton assignsubjectbutton;
+ private JButton backbutton;
+ private JButton editdetailsbutton;
+ /**
+ * @wbp.parser.constructor
+ */
+ private ViewFacultyPanel(Faculty f)
+ {
+ setBackground(new Color(255, 255, 255));
+ this.setSize(1116, 705);
+ setLayout(null);
+
+ JPanel panel = new JPanel();
+ panel.setBackground(new Color(32, 178, 170));
+ panel.setBounds(10, 0, 1096, 188);
+ add(panel);
+ panel.setLayout(null);
+ JLabel lblDisplayingStudentDetails = new JLabel(f.getFacultyName());
+
+ lblDisplayingStudentDetails.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblDisplayingStudentDetails.setForeground(new Color(255, 255, 255));
+ lblDisplayingStudentDetails.setFont(new Font("Segoe UI", Font.BOLD, 30));
+ lblDisplayingStudentDetails.setBounds(661, 11, 415, 44);
+ panel.add(lblDisplayingStudentDetails);
+
+ editdetailsbutton = new JButton("Edit Details");
+ editdetailsbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ editdetailsbutton.setFocusable(false);
+ editdetailsbutton.setForeground(new Color(0, 139, 139));
+ editdetailsbutton.setBackground(new Color(255, 255, 255));
+ editdetailsbutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ editdetailsbutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ editdetailsbutton.setBounds(919, 141, 153, 35);
+
+ panel.add(editdetailsbutton);
+
+ backbutton = new JButton("Back");
+ backbutton.setContentAreaFilled(false);
+ backbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+
+ backbutton.setIcon(new ImageIcon(".\\assets\\back.png"));
+ backbutton.setFocusable(false);
+ backbutton.setForeground(Color.WHITE);
+
+ backbutton.setFont(new Font("Segoe UI", Font.BOLD, 16));
+ backbutton.setBackground(new Color(32, 178, 170));
+ backbutton.setBounds(10, 141, 88, 36);
+ panel.add(backbutton);
+
+ JLabel lblLastLogin = new JLabel("Last Login : ");
+ if(f.getLastLogin()==null||f.getLastLogin().isEmpty())
+ {
+ lblLastLogin.setText("Last Login : No Login");
+ }
+ else
+ {
+ lblLastLogin.setText("Last Login : "+f.getLastLogin());
+ }
+ lblLastLogin.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblLastLogin.setForeground(Color.WHITE);
+ lblLastLogin.setFont(new Font("Tahoma", Font.BOLD, 15));
+ lblLastLogin.setBounds(719, 57, 357, 19);
+ panel.add(lblLastLogin);
+
+ JLabel lblStudentDetails = new JLabel("Faculty Details");
+ lblStudentDetails.setHorizontalAlignment(SwingConstants.LEFT);
+ lblStudentDetails.setForeground(Color.WHITE);
+ lblStudentDetails.setFont(new Font("Segoe UI", Font.BOLD, 30));
+ lblStudentDetails.setBounds(10, 65, 415, 44);
+ panel.add(lblStudentDetails);
+
+ assignsubjectbutton = new JButton("Assign Subject");
+ assignsubjectbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ assignsubjectbutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ assignsubjectbutton.setFocusable(false);
+ assignsubjectbutton.setForeground(new Color(0, 139, 139));
+ assignsubjectbutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ assignsubjectbutton.setBackground(Color.WHITE);
+ assignsubjectbutton.setBounds(743, 141, 153, 35);
+ panel.add(assignsubjectbutton);
+
+ JLabel facultyidlbl = new JLabel("Faculty ID ");
+ facultyidlbl.setBorder(new LineBorder(new Color(192, 192, 192)));
+ facultyidlbl.setBackground(new Color(255, 255, 255));
+ facultyidlbl.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ facultyidlbl.setHorizontalAlignment(SwingConstants.RIGHT);
+ facultyidlbl.setOpaque(true);
+ facultyidlbl.setBounds(309, 66+150, 274, 48);
+ add(facultyidlbl);
+
+ JLabel facultynamelbl = new JLabel("Faculty Name ");
+ facultynamelbl.setOpaque(true);
+ facultynamelbl.setHorizontalAlignment(SwingConstants.RIGHT);
+ facultynamelbl.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ facultynamelbl.setBorder(new LineBorder(new Color(192, 192, 192)));
+ facultynamelbl.setBackground(Color.WHITE);
+ facultynamelbl.setBounds(309, 113+150, 274, 48);
+ add(facultynamelbl);
+
+ JLabel lblAddress = new JLabel("Address ");
+ lblAddress.setOpaque(true);
+ lblAddress.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblAddress.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ lblAddress.setBorder(new LineBorder(new Color(192, 192, 192)));
+ lblAddress.setBackground(Color.WHITE);
+ lblAddress.setBounds(309, 160+150, 274, 48);
+ add(lblAddress);
+
+ JLabel lblEmailId = new JLabel("Email ID ");
+ lblEmailId.setOpaque(true);
+ lblEmailId.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblEmailId.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ lblEmailId.setBorder(new LineBorder(new Color(192, 192, 192)));
+ lblEmailId.setBackground(Color.WHITE);
+ lblEmailId.setBounds(309, 207+150, 274, 48);
+ add(lblEmailId);
+
+ JLabel lblDateOfBirth = new JLabel("Date Of Birth ");
+ lblDateOfBirth.setOpaque(true);
+ lblDateOfBirth.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblDateOfBirth.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ lblDateOfBirth.setBorder(new LineBorder(new Color(192, 192, 192)));
+ lblDateOfBirth.setBackground(Color.WHITE);
+ lblDateOfBirth.setBounds(309, 254+150, 274, 48);
+ add(lblDateOfBirth);
+
+ JLabel lblContactNumber = new JLabel("Contact Number ");
+ lblContactNumber.setOpaque(true);
+ lblContactNumber.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblContactNumber.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ lblContactNumber.setBorder(new LineBorder(new Color(192, 192, 192)));
+ lblContactNumber.setBackground(Color.WHITE);
+ lblContactNumber.setBounds(309, 300+150, 274, 48);
+ add(lblContactNumber);
+
+ JLabel qualificationlbl = new JLabel("Qualification ");
+ qualificationlbl.setOpaque(true);
+ qualificationlbl.setHorizontalAlignment(SwingConstants.RIGHT);
+ qualificationlbl.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ qualificationlbl.setBorder(new LineBorder(new Color(192, 192, 192)));
+ qualificationlbl.setBackground(Color.WHITE);
+ qualificationlbl.setBounds(20, 359+150, 291, 48);
+ add(qualificationlbl);
+
+ JLabel courcelbl = new JLabel("Cource ");
+ courcelbl.setOpaque(true);
+ courcelbl.setHorizontalAlignment(SwingConstants.RIGHT);
+ courcelbl.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ courcelbl.setBorder(new LineBorder(new Color(192, 192, 192)));
+ courcelbl.setBackground(Color.WHITE);
+ courcelbl.setBounds(20, 405+150, 291, 48);
+ add(courcelbl);
+
+ JLabel semoryearlbl = new JLabel("Semester/Year ");
+ semoryearlbl.setOpaque(true);
+ semoryearlbl.setHorizontalAlignment(SwingConstants.RIGHT);
+ semoryearlbl.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ semoryearlbl.setBorder(new LineBorder(new Color(192, 192, 192)));
+ semoryearlbl.setBackground(Color.WHITE);
+ semoryearlbl.setBounds(582, 405+150, 239, 48);
+ add(semoryearlbl);
+
+ JLabel lblsubject = new JLabel("Subject ");
+ lblsubject.setOpaque(true);
+ lblsubject.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblsubject.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ lblsubject.setBorder(new LineBorder(new Color(192, 192, 192)));
+ lblsubject.setBackground(Color.WHITE);
+ lblsubject.setBounds(20, 452+150, 291, 48);
+ add(lblsubject);
+
+ JLabel positionlbl = new JLabel("Position ");
+ positionlbl.setOpaque(true);
+ positionlbl.setHorizontalAlignment(SwingConstants.RIGHT);
+ positionlbl.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ positionlbl.setBorder(new LineBorder(new Color(192, 192, 192)));
+ positionlbl.setBackground(Color.WHITE);
+ positionlbl.setBounds(582, 452+150, 239, 48);
+ add(positionlbl);
+
+ JLabel facultyidlabel = new JLabel(" "+f.getFacultyId());
+ facultyidlabel.setOpaque(true);
+ facultyidlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ facultyidlabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ facultyidlabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ facultyidlabel.setBackground(Color.WHITE);
+ facultyidlabel.setBounds(582, 66+150, 523, 48);
+ add(facultyidlabel);
+
+ JLabel facultynamelabel = new JLabel(" "+f.getFacultyName());
+ facultynamelabel.setOpaque(true);
+ facultynamelabel.setHorizontalAlignment(SwingConstants.LEFT);
+ facultynamelabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ facultynamelabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ facultynamelabel.setBackground(Color.WHITE);
+ facultynamelabel.setBounds(582, 113+150, 523, 48);
+ add(facultynamelabel);
+
+ JLabel addresslabel = new JLabel(" "+f.getAddress());
+ addresslabel.setOpaque(true);
+ addresslabel.setHorizontalAlignment(SwingConstants.LEFT);
+ addresslabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ addresslabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ addresslabel.setBackground(Color.WHITE);
+ addresslabel.setBounds(582, 160+150, 523, 48);
+ add(addresslabel);
+
+ JLabel emailidlabel = new JLabel(" "+f.getEmailId());
+ emailidlabel.setOpaque(true);
+ emailidlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ emailidlabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ emailidlabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ emailidlabel.setBackground(Color.WHITE);
+ emailidlabel.setBounds(582, 207+150, 523, 48);
+ add(emailidlabel);
+
+ JLabel dateofbirthlabel = new JLabel(" "+f.getBirthDate());
+ dateofbirthlabel.setOpaque(true);
+ dateofbirthlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ dateofbirthlabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ dateofbirthlabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ dateofbirthlabel.setBackground(Color.WHITE);
+ dateofbirthlabel.setBounds(582, 254+150, 523, 48);
+ add(dateofbirthlabel);
+
+ JLabel contactnumberlabel = new JLabel(" "+f.getContactNumber());
+ contactnumberlabel.setOpaque(true);
+ contactnumberlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ contactnumberlabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ contactnumberlabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ contactnumberlabel.setBackground(Color.WHITE);
+ contactnumberlabel.setBounds(582, 300+150, 523, 48);
+ add(contactnumberlabel);
+
+ JLabel qualificationlabel = new JLabel(" "+f.getQualification());
+ qualificationlabel.setOpaque(true);
+ qualificationlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ qualificationlabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ qualificationlabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ qualificationlabel.setBackground(Color.WHITE);
+ qualificationlabel.setBounds(309, 359+150, 274, 48);
+ add(qualificationlabel);
+
+ JLabel courcenamelabel = new JLabel();
+ if(f.getCourceCode()==null ||f.getCourceCode().equals("Not Assigned"))
+ {
+ courcenamelabel.setText(" "+f.getCourceCode());
+ }
+ else
+ {
+ courcenamelabel.setText(" "+f.getCourceName());
+ }
+
+ courcenamelabel.setOpaque(true);
+ courcenamelabel.setHorizontalAlignment(SwingConstants.LEFT);
+ courcenamelabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ courcenamelabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ courcenamelabel.setBackground(Color.WHITE);
+ courcenamelabel.setBounds(309, 405+150, 274, 48);
+ add(courcenamelabel);
+
+ JLabel semoryearlabel = new JLabel();
+ if(f.getCourceCode()==null || f.getCourceCode().equals("Not Assigned") )
+ {
+ semoryearlabel.setText(" Not Assigned");
+ }
+ else
+ {
+ semoryearlabel.setText(" "+new CourceData().getsemoryear(f.getCourceCode())+"-"+f.getSemorYear()+" "+" ("+f.getCourceCode()+")");
+ }
+ semoryearlabel.setOpaque(true);
+ semoryearlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ semoryearlabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ semoryearlabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ semoryearlabel.setBackground(Color.WHITE);
+ semoryearlabel.setBounds(820, 405+150, 285, 48);
+ add(semoryearlabel);
+
+ JLabel subjectlabel = new JLabel(" "+f.getSubject());
+ subjectlabel.setOpaque(true);
+ subjectlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ subjectlabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ subjectlabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ subjectlabel.setBackground(Color.WHITE);
+ subjectlabel.setBounds(309, 452+150, 274, 48);
+ add(subjectlabel);
+
+ JLabel postionlabel = new JLabel(" "+f.getPosition());
+ postionlabel.setOpaque(true);
+ postionlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ postionlabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ postionlabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ postionlabel.setBackground(Color.WHITE);
+ postionlabel.setBounds(820, 452+150, 285, 48);
+ add(postionlabel);
+
+ JLabel profilepiclabel = new JLabel();
+ profilepiclabel.setBounds(20, 66+150, 250, 270);
+ add(profilepiclabel);
+ profilepiclabel.setIcon(new ImageIcon(f.getProfilePic(250, 270)));
+ profilepiclabel.setBorder(new LineBorder(new Color(192, 192, 192), 2));
+ profilepiclabel.setOpaque(true);
+ profilepiclabel.setBackground(new Color(240, 248, 255));
+ profilepiclabel.setFont(new Font("Tahoma", Font.PLAIN, 16));
+ profilepiclabel.setHorizontalAlignment(SwingConstants.CENTER);
+ JLabel lblsemoryear = new JLabel("Experience ");
+ lblsemoryear.setOpaque(true);
+ lblsemoryear.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblsemoryear.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ lblsemoryear.setBorder(new LineBorder(new Color(192, 192, 192)));
+ lblsemoryear.setBackground(Color.WHITE);
+ lblsemoryear.setBounds(582, 359+150, 239, 48);
+ add(lblsemoryear);
+
+ JLabel experiencelabel = new JLabel(" "+f.getExperience());
+ experiencelabel.setOpaque(true);
+ experiencelabel.setHorizontalAlignment(SwingConstants.LEFT);
+ experiencelabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ experiencelabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ experiencelabel.setBackground(Color.WHITE);
+ experiencelabel.setBounds(820, 359+150, 285, 48);
+ add(experiencelabel);
+
+
+ }
+ public ViewFacultyPanel(Faculty f, AdminMain am,JComponent lastpanel)
+ {
+ // TODO Auto-generated constructor stub
+ this(f);
+ this.lastpanel=lastpanel;
+ JLabel lblJoinedDate = new JLabel("Joined Date ");
+ lblJoinedDate.setOpaque(true);
+ lblJoinedDate.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblJoinedDate.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ lblJoinedDate.setBorder(new LineBorder(new Color(192, 192, 192)));
+ lblJoinedDate.setBackground(Color.WHITE);
+ lblJoinedDate.setBounds(20, 649, 291, 48);
+ add(lblJoinedDate);
+
+ JLabel joineddatelabel = new JLabel(" "+f.getJoinedDate());
+ joineddatelabel.setOpaque(true);
+ joineddatelabel.setHorizontalAlignment(SwingConstants.LEFT);
+ joineddatelabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ joineddatelabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ joineddatelabel.setBackground(Color.WHITE);
+ joineddatelabel.setBounds(309, 649, 274, 48);
+ add(joineddatelabel);
+
+ JLabel lblPassword = new JLabel("Password ");
+ lblPassword.setOpaque(true);
+ lblPassword.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblPassword.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ lblPassword.setBorder(new LineBorder(new Color(192, 192, 192)));
+ lblPassword.setBackground(Color.WHITE);
+ lblPassword.setBounds(582, 649, 239, 48);
+ add(lblPassword);
+
+ JLabel passwordlabel = new JLabel(" "+f.getPassword());
+ passwordlabel.setOpaque(true);
+ passwordlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ passwordlabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ passwordlabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ passwordlabel.setBackground(Color.WHITE);
+ passwordlabel.setBounds(820, 649, 285, 48);
+ add(passwordlabel);
+
+ backbutton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ am.viewfacultypanel.setVisible(false);
+ if(lastpanel.getName().equals("Faculty Panel"))
+ {
+ if(am.facultypanel.viewbutton.getText().equals("Photo View"))
+ {
+ am.facultypanel.createtablemodel();
+ }
+ else
+ {
+ am.facultypanel.createphotoviewpanel();
+ }
+ am.facultypanel.setVisible(true);
+ }
+
+ else if(lastpanel.getName().equals("Search Panel"))
+ {
+ am.searchpanel.createtablemodel();
+ am.searchpanel.setVisible(true);
+ }
+ else if(lastpanel.getName().equals("Users Panel"))
+ {
+ am.userspanel.createtablemodel();
+ am.userspanel.setVisible(true);
+ }
+ else
+ {
+ lastpanel.setVisible(true);
+ }
+
+ }
+ });
+ editdetailsbutton.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO Auto-generated method stub
+ AddFaculityDialog ad=new AddFaculityDialog(am,f);
+ ad.setLocationRelativeTo(null);
+ ad.setVisible(true);
+
+ }
+
+ }
+
+ );
+ assignsubjectbutton.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent arg0) {
+ AssignSubjectDialog as=new AssignSubjectDialog(f,am);
+ as.setLocation(450, 100);
+ as.setVisible(true);
+
+ }
+ });
+
+ }
+ public ViewFacultyPanel(Faculty f, FacultyMain fm, JComponent lastpanel)
+ {
+ // TODO Auto-generated constructor stub
+ this(f);
+ this.lastpanel=lastpanel;
+ assignsubjectbutton.setVisible(false);
+ editdetailsbutton.setVisible(false);
+ backbutton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ fm.viewfacultypanel.setVisible(false);
+ if(lastpanel.getName().equals("Faculty Panel"))
+ {
+ if(fm.facultypanel.viewbutton.getText().equals("Photo View"))
+ {
+ fm.facultypanel.createtablemodel();
+ }
+ else
+ {
+ fm.facultypanel.createphotoviewpanel();
+ }
+ fm.facultypanel.setVisible(true);
+ }
+
+ else if(lastpanel.getName().equals("Search Panel"))
+ {
+ fm.searchpanel.createtablemodel();
+ fm.searchpanel.setVisible(true);
+ }
+ else
+ {
+ lastpanel.setVisible(true);
+ }
+
+ }
+ });
+ }
+ public ViewFacultyPanel(Faculty f, FacultyMain fm)
+ {
+ // TODO Auto-generated constructor stub
+ this(f);
+ assignsubjectbutton.setVisible(false);
+ editdetailsbutton.setText("Change Password");
+ backbutton.setVisible(false);
+ editdetailsbutton.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+
+ ChangePasswordDialog cp=new ChangePasswordDialog(f);
+ cp.setLocationRelativeTo(null);
+ cp.setVisible(true);
+
+ }
+
+ }
+ );
+
+ }
+
+
+ public ViewFacultyPanel(Faculty f, StudentMain sm, JComponent lastpanel)
+ {
+ // TODO Auto-generated constructor stub
+ this(f);
+ this.lastpanel=lastpanel;
+ assignsubjectbutton.setVisible(false);
+ editdetailsbutton.setVisible(false);
+ backbutton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ sm.viewfacultypanel.setVisible(false);
+ if(lastpanel.getName().equals("Faculty Panel"))
+ {
+ if(sm.facultypanel.viewbutton.getText().equals("Photo View"))
+ {
+ sm.facultypanel.createtablemodel();
+ }
+ else
+ {
+ sm.facultypanel.createphotoviewpanel();
+ }
+ sm.facultypanel.setVisible(true);
+ }
+
+ else if(lastpanel.getName().equals("Search Panel"))
+ {
+ sm.searchpanel.createtablemodel();
+ sm.searchpanel.setVisible(true);
+ }
+ else
+ {
+ lastpanel.setVisible(true);
+ }
+
+ }
+ });
+ }
+}
diff --git a/src/collegeapplication/login/LoginPageFrame.java b/src/collegeapplication/login/LoginPageFrame.java
new file mode 100644
index 0000000..fdf90b3
--- /dev/null
+++ b/src/collegeapplication/login/LoginPageFrame.java
@@ -0,0 +1,343 @@
+package collegeapplication.login;
+
+import java.awt.Color;
+import java.awt.EventQueue;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.IOException;
+
+import javax.imageio.ImageIO;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.SwingConstants;
+import javax.swing.Timer;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.LineBorder;
+import javax.swing.border.MatteBorder;
+
+import collegeapplication.admin.Admin;
+import collegeapplication.admin.AdminData;
+import collegeapplication.common.DataBaseConnection;
+
+/*
+ * Title : LoginPageFrame.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : Main login frame
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+@SuppressWarnings("serial")
+public class LoginPageFrame extends JFrame implements ActionListener
+{
+
+ private JPanel contentPane;
+ private JButton facultybutton;
+ private JButton studentbutton;
+ private JButton adminbutton;
+ private LoginPanel studentloginpanel,facultyloginpanel,adminloginpanel;
+ private boolean adminchanging=false,studentchanging=false,facultychanging=false;
+ private int adminpanelx=-2300,adminpanely=240;
+ private int facultypanelx=-900,facultypanely=240;
+ private int studentpanelx=500,studentpanely=240;
+ private int underlinelabelx=280,underlinelabelwidth=140;
+ private Timer timer;
+ private int imagenumber=1;
+ private JLabel bgimagelabel;
+ private JLabel underlinelabel;
+ private JPanel loginbuttonpanel;
+ /**
+ * Launch the application.
+ */
+ public static void main(String[] args) {
+ EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ try {
+ if(DataBaseConnection.checkconnection())
+ {
+ LoginPageFrame frame = new LoginPageFrame();
+ frame.setVisible(true);
+ frame.setLocation(-7, 0);
+ }
+ else
+ {
+ JOptionPane.showMessageDialog(null, "Start the Database Server first","Error",JOptionPane.ERROR_MESSAGE);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ }
+
+ /**
+ * Create the frame.
+ */
+ public LoginPageFrame() {
+ timer=new Timer(5,this);
+ Timer imagetimer=new Timer(5000,this);
+ imagetimer.start();
+ setTitle("Login");
+ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ setSize(1380,733);
+ setLocationRelativeTo(null);
+ contentPane = new JPanel();
+ contentPane.setBorder(new LineBorder(Color.LIGHT_GRAY, 2));
+ contentPane.setBackground(new Color(255, 255, 255));
+ setContentPane(contentPane);
+ contentPane.setLayout(null);
+
+
+
+ Admin ad=new AdminData().getAdminData();
+
+ JPanel panel = new JPanel();
+ panel.setBackground(new Color(0, 139, 139,220));
+ panel.setBounds(0, 26, 1364, 159);
+ contentPane.add(panel);
+ panel.setLayout(null);
+
+ JLabel lblSilverOakCollage = new JLabel(ad.getCollageName());
+ lblSilverOakCollage.setForeground(Color.WHITE);
+ lblSilverOakCollage.setFont(new Font("Segoe UI", Font.BOLD, 30));
+ lblSilverOakCollage.setHorizontalAlignment(SwingConstants.LEFT);
+ lblSilverOakCollage.setBounds(160, 43, 749, 57);
+ panel.add(lblSilverOakCollage);
+
+ JLabel lblLogo = new JLabel("logo");
+ lblLogo.setBounds(10, 10, 140, 140);
+ lblLogo.setIcon(new ImageIcon(ad.getRoundedProfilePic(lblLogo.getWidth(), lblLogo.getHeight(), lblLogo.getWidth())));
+
+
+ panel.add(lblLogo);
+
+ studentloginpanel=new LoginPanel("Student",new ImageIcon("./assets/studentlogin.png"),this);
+ studentloginpanel.setVisible(true);
+ studentloginpanel.setLocation(studentpanelx,studentpanely);
+
+ facultyloginpanel=new LoginPanel("Faculty",new ImageIcon("./assets/facultylogin.png"),this);
+ facultyloginpanel.setVisible(true);
+ facultyloginpanel.setLocation(facultypanelx, facultypanely);
+
+ adminloginpanel=new LoginPanel("Admin",new ImageIcon("./assets/adminlogin.png"),this);
+ adminloginpanel.setVisible(true);
+ adminloginpanel.setLocation(adminpanelx, adminpanely);
+
+
+ contentPane.add(studentloginpanel);
+ contentPane.add(facultyloginpanel);
+ contentPane.add(adminloginpanel);
+
+
+ loginbuttonpanel = new JPanel()
+ {
+ protected void paintComponent(Graphics g)
+ {
+ g.setColor( getBackground() );
+ g.fillRect(0, 0, getWidth(), getHeight());
+ super.paintComponent(g);
+ }
+ };
+ loginbuttonpanel.setOpaque(false);
+ loginbuttonpanel.setBackground(new Color(0,0,0,120));
+ loginbuttonpanel.setBounds(500, 189, 420, 40);
+ loginbuttonpanel.setLayout(null);
+ contentPane.add(loginbuttonpanel);
+
+
+
+ adminbutton = new JButton("Admin");
+ adminbutton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ activeButton(adminbutton);
+ disableButton(facultybutton);
+ disableButton(studentbutton);
+ adminchanging=true;
+ studentchanging=false;
+ facultychanging=false;
+ timer.start();
+ }
+ });
+ this.buttonStyle(adminbutton);
+ adminbutton.setBounds(0, 0, 140, 35);
+ loginbuttonpanel.add(adminbutton);
+
+
+ facultybutton = new JButton("Faculty");
+ facultybutton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ activeButton(facultybutton);
+ disableButton(studentbutton);
+ disableButton(adminbutton);
+ facultychanging=true;
+ adminchanging=false;
+ studentchanging=false;
+ timer.start();
+ }
+ });
+ this.buttonStyle(facultybutton);
+ facultybutton.setBounds(140, 0, 140, 35);
+ loginbuttonpanel.add(facultybutton);
+
+ studentbutton = new JButton("Student");
+ studentbutton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ activeButton(studentbutton);
+ disableButton(facultybutton);
+ disableButton(adminbutton);
+ studentchanging=true;
+ adminchanging=false;
+ facultychanging=false;
+ timer.start();
+ }
+
+ });
+ studentbutton.setBounds(280, 0, 140, 35);
+ this.buttonStyle(studentbutton);
+ loginbuttonpanel.add(studentbutton);
+ activeButton(studentbutton);
+
+ underlinelabel = new JLabel("");
+ underlinelabel.setBorder(new MatteBorder(3, 0, 0, 0, (Color)Color.CYAN));
+ underlinelabel.setBounds(underlinelabelx, 37, underlinelabelwidth, 4);
+ loginbuttonpanel.add(underlinelabel);
+
+
+
+ bgimagelabel = new JLabel("image");
+ bgimagelabel.setBounds(0, 11, 1380, 683);
+ contentPane.add(bgimagelabel);
+ this.setBackgroundImage();
+
+
+
+ }
+
+ protected void disposethis() {
+ // TODO Auto-generated method stub
+ this.dispose();
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO Auto-generated method stub
+ if(!adminchanging&&!studentchanging&&!facultychanging)
+ {
+
+ imagenumber++;
+ if(imagenumber>5)
+ {
+ imagenumber=1;
+
+ }
+ this.setBackgroundImage();
+ }
+
+ if(adminchanging)
+ {
+ if(adminpanelx==500)
+ {
+ adminchanging=false;
+ timer.stop();
+ }
+ else
+ {
+
+ adminpanelx+=50;
+ studentpanelx+=50;
+ facultypanelx+=50;
+ underlinelabelx-=5;
+ }
+ }
+ else if(facultychanging)
+ {
+ if(facultypanelx==500)
+ {
+ facultychanging=false;
+ timer.stop();
+ }
+ else
+ {
+ if(facultypanelx>500)
+ {
+ adminpanelx-=50;
+ studentpanelx-=50;
+ facultypanelx-=50;
+ underlinelabelx+=5;
+ }
+ else
+ {
+ adminpanelx+=50;
+ studentpanelx+=50;
+ facultypanelx+=50;
+ underlinelabelx-=5;
+ }
+ }
+ }
+ else if(studentchanging)
+ {
+ if(studentpanelx==500)
+ {
+ studentchanging=false;
+ timer.stop();
+ }
+ else
+ {
+
+ adminpanelx-=50;
+ studentpanelx-=50;
+ facultypanelx-=50;
+ underlinelabelx+=5;
+
+ }
+ }
+
+ studentloginpanel.setLocation(studentpanelx,studentpanely);
+ facultyloginpanel.setLocation(facultypanelx, facultypanely);
+ adminloginpanel.setLocation(adminpanelx, adminpanely);
+ underlinelabel.setLocation(underlinelabelx, underlinelabel.getY());
+ this.repaint();
+
+
+ }
+ public void buttonStyle(JButton button)
+ {
+ button.setFocusable(true);
+ button.setForeground(Color.WHITE);
+ button.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ button.setBorder(new EmptyBorder(0,0,0,0));
+ button.setBackground(Color.black);
+ button.setFocusPainted(false);
+ button.setBorderPainted(false);
+ button.setOpaque(false);
+
+ }
+ public void activeButton(JButton button)
+ {
+ button.setForeground(Color.cyan);
+
+ }
+ public void disableButton(JButton button)
+ {
+ button.setForeground(Color.white);
+ }
+ public void setBackgroundImage()
+ {
+ try {
+ Image image=ImageIO.read(new File(".//assets//backgroundimage"+imagenumber+".jpg"));
+ bgimagelabel.setIcon(new ImageIcon(image.getScaledInstance(bgimagelabel.getWidth(), bgimagelabel.getHeight(), Image.SCALE_SMOOTH)));
+
+ } catch (IOException e) {
+
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/collegeapplication/login/LoginPanel.java b/src/collegeapplication/login/LoginPanel.java
new file mode 100644
index 0000000..2e5418c
--- /dev/null
+++ b/src/collegeapplication/login/LoginPanel.java
@@ -0,0 +1,200 @@
+package collegeapplication.login;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JPasswordField;
+import javax.swing.SwingConstants;
+import javax.swing.UIManager;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.LineBorder;
+
+import collegeapplication.admin.AdminData;
+import collegeapplication.admin.AdminMain;
+import collegeapplication.common.HintPasswordField;
+import collegeapplication.common.HintTextField;
+import collegeapplication.common.UserData;
+import collegeapplication.faculty.Faculty;
+import collegeapplication.faculty.FacultyData;
+import collegeapplication.faculty.FacultyMain;
+import collegeapplication.student.Student;
+import collegeapplication.student.StudentData;
+import collegeapplication.student.StudentMain;
+
+/*
+ * Title : LoginPanel.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : For login
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+@SuppressWarnings("serial")
+public class LoginPanel extends JPanel implements ActionListener
+{
+
+ public HintTextField useridfield;
+ public JPasswordField passwordfield;
+ public JButton loginbutton;
+ String loginprofile;
+ private LoginPageFrame loginpageframe;
+
+ /**
+ * Create the panel.
+ */
+ public LoginPanel(String loginprofile,ImageIcon imageicon,LoginPageFrame lpf) {
+
+ this.loginprofile=loginprofile;
+ this.loginpageframe=lpf;
+ setBorder(new LineBorder(new Color(192, 192, 192)));
+ setBackground(new Color(0, 0, 0,80));
+ setBounds(490, 206, 420, 434);
+ setLayout(null);
+
+ JLabel lblPassword = new JLabel("");
+ lblPassword.setOpaque(true);
+ lblPassword.setBackground(new Color(32, 178, 170));
+ lblPassword.setIcon(new ImageIcon(".\\assets\\password1.png"));
+ lblPassword.setBounds(20, 272, 60, 44);
+ add(lblPassword);
+ lblPassword.setHorizontalAlignment(SwingConstants.CENTER);
+ lblPassword.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ lblPassword.setBorder(new LineBorder(new Color(192, 192, 192)));
+
+ useridfield = new HintTextField("Userid");
+ useridfield.setBorder(new EmptyBorder(0,3,0,0));
+ useridfield.setToolTipText("User Id");
+ useridfield.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ useridfield.setBounds(80, 196, 323, 44);
+ useridfield.setForeground(Color.DARK_GRAY);
+ add(useridfield);
+ useridfield.setColumns(10);
+
+ JLabel lblEmailId = new JLabel("");
+ lblEmailId.setOpaque(true);
+ lblEmailId.setFocusable(true);
+ lblEmailId.setBackground(new Color(32, 178, 170));
+ lblEmailId.setIcon(new ImageIcon(".\\assets\\userid.png"));
+ lblEmailId.setBounds(20, 196, 60, 44);
+ add(lblEmailId);
+ lblEmailId.setHorizontalAlignment(SwingConstants.CENTER);
+ lblEmailId.setBorder(new LineBorder(new Color(192, 192, 192)));
+ lblEmailId.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+
+ loginbutton = new JButton("Login");
+
+
+ loginbutton.setFont(new Font("Segoe UI", Font.BOLD, 16));
+ loginbutton.setForeground(new Color(255, 255, 255));
+ loginbutton.addActionListener(this);
+ loginbutton.setBackground(new Color(32, 178, 170));
+ loginbutton.setBounds(20, 355, 383, 44);
+ loginbutton.setFocusable(false);
+ loginbutton.setBorderPainted(false);
+ add(loginbutton);
+
+ JLabel lblStudentLogin = new JLabel(loginprofile+" Login");
+ lblStudentLogin.setForeground(new Color(255, 255, 255));
+ lblStudentLogin.setFont(new Font("Segoe UI", Font.BOLD, 25));
+ lblStudentLogin.setHorizontalAlignment(SwingConstants.CENTER);
+ lblStudentLogin.setBounds(10, 121, 420, 38);
+ add(lblStudentLogin);
+
+ JLabel userprofilelabel = new JLabel();
+ userprofilelabel.setIcon(imageicon);
+ userprofilelabel.setBounds(169, 28, 100, 98);
+ add(userprofilelabel);
+
+ passwordfield = new HintPasswordField("Password");
+ passwordfield.setBorder(useridfield.getBorder());
+ passwordfield.setToolTipText("Password");
+ passwordfield.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ passwordfield.setBounds(80, 272, 261, 44);
+ add(passwordfield);
+
+ JButton showandhidebutton = new JButton("show");
+ showandhidebutton.setForeground(new Color(255, 255, 255));
+ showandhidebutton.setBounds(341, 272, 62, 44);
+ showandhidebutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ showandhidebutton.setFocusable(false);
+ showandhidebutton.setFocusPainted(false);
+ showandhidebutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ showandhidebutton.setBackground(new Color(32, 178, 170));
+ showandhidebutton.setBorderPainted(false);
+ showandhidebutton.addActionListener(e->
+ {
+ if(showandhidebutton.getText().equals("show"))
+ {
+ passwordfield.setEchoChar('\u0000');
+ showandhidebutton.setText("hide");
+ }
+ else
+ {
+ passwordfield.setEchoChar((Character)UIManager.get("PasswordField.echoChar"));
+ showandhidebutton.setText("show");
+ }
+ });
+ add(showandhidebutton);
+
+ }
+ @SuppressWarnings("deprecation")
+ public void actionPerformed(ActionEvent arg0)
+ {
+ // TODO Auto-generated method stub
+ if(loginprofile.equals("Admin"))
+ {
+ boolean result=new AdminData().checkPassword(useridfield.getText(), passwordfield.getText());
+ if(result==true)
+ {
+ AdminMain am=new AdminMain();
+ am.setVisible(true);
+ am.setLocationRelativeTo(null);
+ loginpageframe.dispose();
+
+
+
+ }
+
+ }
+ else if(loginprofile.equals("Faculty"))
+ {
+ boolean result=new FacultyData().checkPassword(useridfield.getText(), passwordfield.getText());
+ if(result==true)
+ {
+ Faculty f=new FacultyData().getFacultyInfobyUserId(useridfield.getText());
+ if(!f.getCourceCode().equals("Not Assigned"))
+ {
+ new UserData().addFacultyLoginTime(f);
+ FacultyMain fm=new FacultyMain(f);
+ fm.setVisible(true);
+ fm.setLocationRelativeTo(null);
+ loginpageframe.dispose();
+ }
+ else
+ {
+ JOptionPane.showMessageDialog(null,"Your account is not activated. contact principal","Login Error",JOptionPane.ERROR_MESSAGE);
+ }
+
+ }
+ }
+ else if(loginprofile.equals("Student"))
+ {
+ boolean result=new StudentData().checkPassword(useridfield.getText(), passwordfield.getText());
+ if(result==true)
+ {
+ Student s=new StudentData().getStudentDetailsByUserId(useridfield.getText());
+ new UserData().addStudentLoginTime(s);
+ StudentMain sm=new StudentMain(s);
+ sm.setVisible(true);
+ sm.setLocationRelativeTo(null);
+ loginpageframe.dispose();
+
+ }
+ }
+ }
+}
diff --git a/src/collegeapplication/student/AddStudentDialog.java b/src/collegeapplication/student/AddStudentDialog.java
new file mode 100644
index 0000000..c589cab
--- /dev/null
+++ b/src/collegeapplication/student/AddStudentDialog.java
@@ -0,0 +1,731 @@
+package collegeapplication.student;
+
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.FileDialog;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.io.File;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import javax.imageio.ImageIO;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JSpinner;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.SpinnerDateModel;
+import javax.swing.SwingConstants;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.LineBorder;
+import javax.swing.border.MatteBorder;
+
+import collegeapplication.admin.AdminMain;
+import collegeapplication.common.HintTextField;
+import collegeapplication.cource.CourceData;
+import collegeapplication.cource.RollNumberData;
+import collegeapplication.subject.SubjectData;
+
+/*
+ * Title : AddStudentDialog.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : For adding new student or edit student details
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+@SuppressWarnings("serial")
+public class AddStudentDialog extends JDialog implements ActionListener {
+
+ private final JPanel contentPanel = new JPanel();
+ private JTextField rollnumberfield;
+ private JTextField firstnamefield;
+ private JTextField lastnamefield;
+ private JTextField emailidfield;
+ private JTextField contactnumberfield;
+ private JTextField statefield;
+ private JTextField cityfield;
+ private JTextField fathernamefield;
+ private JTextField fatheroccupationfield;
+ private JTextField mothernamefield;
+ private JTextField motheroccupationfield;
+ private JLabel lblPhoto;
+ private JLabel filename;
+ private JComboBox courcenamecombo, semoryearcombo, optionalsubjectcombo, gendercombo;
+ private JSpinner birthdatespinner;
+ private JButton choosefilebutton, addstudentbutton;
+ private File file = new File("./assets/profilepicicon.jpg");
+ private String imagepath = null;
+ private JLabel filesize;
+ private AdminMain am;
+ private JLabel profilepiclabel, filesizenote;
+ private JLabel Errorlabel;
+ private static AddStudentDialog dialog;
+ private StudentPanel sp;
+ private JLabel headerlabel;
+ private Student student;
+
+ /**
+ * Launch the application.
+ */
+ public static void main(String[] args) {
+
+ // If translucent windows aren't supported, exit.
+
+ JFrame.setDefaultLookAndFeelDecorated(true);
+
+ try {
+ dialog = new AddStudentDialog();
+
+ dialog.setVisible(true);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Create the dialog.
+ *
+ */
+ public AddStudentDialog() {
+
+ super(new JFrame(), true);
+ this.setResizable(false);
+ this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+ getContentPane().setBackground(Color.WHITE);
+ setSize(850, 700);
+ getContentPane().setLayout(null);
+ contentPanel.setLayout(null);
+ contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
+
+ headerlabel = new JLabel("Add New Student");
+ headerlabel.setFont(new Font("Segoe UI", Font.PLAIN, 15));
+ headerlabel.setHorizontalAlignment(SwingConstants.CENTER);
+ headerlabel.setBounds(0, 0, 834, 40);
+ getContentPane().add(headerlabel);
+
+ headerlabel.setBackground(new Color(32, 178, 170));
+ headerlabel.setOpaque(true);
+ headerlabel.setForeground(new Color(255, 255, 255));
+ headerlabel.setFont(new Font("Arial", Font.BOLD, 23));
+ headerlabel.setBorder(new MatteBorder(0, 0, 1, 0, (Color) Color.LIGHT_GRAY));
+
+ courcenamecombo = new JComboBox(new CourceData().getCourceName());
+ courcenamecombo.setForeground(Color.DARK_GRAY);
+ courcenamecombo.setToolTipText("Cource");
+ courcenamecombo.setFont(new Font("Segoe UI Historic", Font.PLAIN, 18));
+ courcenamecombo.addActionListener(this);
+ courcenamecombo.setBackground(new Color(255, 255, 255));
+ courcenamecombo.setBounds(10, 51, 400, 40);
+ courcenamecombo.setFocusable(false);
+ getContentPane().add(courcenamecombo);
+
+ semoryearcombo = new JComboBox();
+ semoryearcombo.setPrototypeDisplayValue("--select prototype--");
+ semoryearcombo.setToolTipText("Semester/Year");
+ semoryearcombo.setFont(new Font("Segoe UI Historic", Font.PLAIN, 18));
+ semoryearcombo.setBackground(Color.WHITE);
+ semoryearcombo.setFocusable(false);
+ semoryearcombo.setBounds(424, 51, 400, 40);
+ semoryearcombo.addActionListener(this);
+ semoryearcombo.setModel(new DefaultComboBoxModel(new String[] { "" }));
+ getContentPane().add(semoryearcombo);
+
+ rollnumberfield = new HintTextField("");
+ rollnumberfield.setToolTipText("Roll Number");
+ rollnumberfield.setFocusable(false);
+ rollnumberfield.setFont(new Font("Segoe UI Historic", Font.PLAIN, 16));
+ rollnumberfield.setBounds(134, 116, 276, 40);
+ getContentPane().add(rollnumberfield);
+ rollnumberfield.setColumns(10);
+
+ JLabel lblRollNo = new JLabel("Roll Number");
+ lblRollNo.setForeground(Color.DARK_GRAY);
+ lblRollNo.setFont(new Font("Segoe UI Historic", Font.PLAIN, 19));
+ lblRollNo.setFocusable(true);
+ lblRollNo.setBounds(20, 116, 106, 40);
+ getContentPane().add(lblRollNo);
+
+ optionalsubjectcombo = new JComboBox();
+ optionalsubjectcombo.setToolTipText("Optional Subject");
+ optionalsubjectcombo.setFocusable(false);
+ optionalsubjectcombo.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER) {
+ optionalsubjectcombo.setFocusable(false);
+ firstnamefield.setFocusable(true);
+ }
+ }
+ });
+ optionalsubjectcombo.setFont(new Font("Segoe UI Historic", Font.PLAIN, 16));
+ optionalsubjectcombo.setBackground(Color.WHITE);
+ optionalsubjectcombo.setBounds(424, 116, 400, 40);
+ optionalsubjectcombo.addActionListener(this);
+ getContentPane().add(optionalsubjectcombo);
+
+ firstnamefield = new HintTextField("First Name");
+ firstnamefield.setToolTipText("First Name");
+ firstnamefield.setForeground(Color.DARK_GRAY);
+ firstnamefield.setFont(new Font("Segoe UI Emoji", Font.PLAIN, 18));
+ firstnamefield.addActionListener(this);
+ firstnamefield.setColumns(10);
+ firstnamefield.setBounds(10, 177, 400, 40);
+ getContentPane().add(firstnamefield);
+
+ lastnamefield = new HintTextField("Last Name");
+ lastnamefield.setToolTipText("Last Name");
+ lastnamefield.setForeground(Color.DARK_GRAY);
+ lastnamefield.setFont(new Font("Segoe UI Emoji", Font.PLAIN, 18));
+ lastnamefield.setColumns(10);
+ lastnamefield.setBounds(424, 177, 400, 40);
+ getContentPane().add(lastnamefield);
+
+ emailidfield = new HintTextField(" Email ID");
+ emailidfield.setToolTipText("Email ID");
+ emailidfield.setForeground(Color.DARK_GRAY);
+ emailidfield.setFont(new Font("Segoe UI Emoji", Font.PLAIN, 18));
+ emailidfield.setColumns(10);
+ emailidfield.setBounds(10, 240, 400, 40);
+ getContentPane().add(emailidfield);
+
+ contactnumberfield = new HintTextField(" Contact Number");
+ contactnumberfield.setToolTipText("Contact Number");
+ contactnumberfield.setForeground(Color.DARK_GRAY);
+ contactnumberfield.setFont(new Font("Segoe UI Emoji", Font.PLAIN, 18));
+ contactnumberfield.setColumns(10);
+ contactnumberfield.setBounds(424, 240, 400, 40);
+ getContentPane().add(contactnumberfield);
+
+ JLabel lblDateOfBirth = new JLabel("Date of Birth");
+ lblDateOfBirth.setForeground(Color.DARK_GRAY);
+ lblDateOfBirth.setFont(new Font("Segoe UI Historic", Font.PLAIN, 19));
+ lblDateOfBirth.setBounds(10, 302, 114, 40);
+ getContentPane().add(lblDateOfBirth);
+
+ birthdatespinner = new JSpinner();
+ birthdatespinner.setToolTipText("Date Of Birth");
+ birthdatespinner.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.getKeyCode() == KeyEvent.VK_ENTER) {
+ birthdatespinner.setFocusable(false);
+ }
+ }
+ });
+ birthdatespinner.setFont(new Font("Segoe UI Historic", Font.PLAIN, 18));
+ SimpleDateFormat model = new SimpleDateFormat("dd-MM-yyyy");
+ birthdatespinner.setModel(new SpinnerDateModel());
+ birthdatespinner.setEditor(new JSpinner.DateEditor(birthdatespinner, model.toPattern()));
+ birthdatespinner.setBounds(134, 302, 276, 42);
+ getContentPane().add(birthdatespinner);
+
+ gendercombo = new JComboBox();
+ gendercombo.setToolTipText("Gender");
+ gendercombo.setModel(new DefaultComboBoxModel(new String[] { "---Select Gender---", "Male", "Female" }));
+ gendercombo.setFont(new Font("Segoe UI Historic", Font.PLAIN, 16));
+ gendercombo.setBackground(Color.WHITE);
+ gendercombo.addActionListener(this);
+ gendercombo.setBounds(424, 303, 400, 40);
+ gendercombo.setFocusable(false);
+ getContentPane().add(gendercombo);
+
+ statefield = new HintTextField("State");
+ statefield.setToolTipText("State");
+ statefield.setForeground(Color.DARK_GRAY);
+ statefield.setFont(new Font("Segoe UI Emoji", Font.PLAIN, 18));
+ statefield.setColumns(10);
+ statefield.setBounds(10, 363, 400, 40);
+ getContentPane().add(statefield);
+
+ cityfield = new HintTextField(" City");
+ cityfield.setToolTipText("City");
+ cityfield.setForeground(Color.DARK_GRAY);
+ cityfield.setFont(new Font("Segoe UI Emoji", Font.PLAIN, 18));
+ cityfield.setColumns(10);
+ cityfield.setBounds(424, 363, 400, 40);
+ getContentPane().add(cityfield);
+
+ fathernamefield = new HintTextField(" Father Name");
+ fathernamefield.setToolTipText("Father Name");
+ fathernamefield.setForeground(Color.DARK_GRAY);
+ fathernamefield.setFont(new Font("Segoe UI Emoji", Font.PLAIN, 18));
+ fathernamefield.setColumns(10);
+ fathernamefield.setBounds(10, 424, 400, 40);
+ getContentPane().add(fathernamefield);
+
+ fatheroccupationfield = new HintTextField(" Father Occupation");
+ fatheroccupationfield.setToolTipText("Father Occupation");
+ fatheroccupationfield.setForeground(Color.DARK_GRAY);
+ fatheroccupationfield.setFont(new Font("Segoe UI Emoji", Font.PLAIN, 18));
+ fatheroccupationfield.setColumns(10);
+ fatheroccupationfield.setBounds(424, 424, 400, 40);
+ getContentPane().add(fatheroccupationfield);
+
+ mothernamefield = new HintTextField(" Mother Name");
+ mothernamefield.setToolTipText("Mother Name");
+ mothernamefield.setForeground(Color.DARK_GRAY);
+ mothernamefield.setFont(new Font("Segoe UI Emoji", Font.PLAIN, 18));
+ mothernamefield.setColumns(10);
+ mothernamefield.setBounds(10, 485, 400, 40);
+ getContentPane().add(mothernamefield);
+
+ motheroccupationfield = new HintTextField(" Mother Occupation");
+ motheroccupationfield.setToolTipText("Mother Occupation");
+ motheroccupationfield.setForeground(Color.DARK_GRAY);
+ motheroccupationfield.setFont(new Font("Segoe UI Emoji", Font.PLAIN, 18));
+ motheroccupationfield.setColumns(10);
+ motheroccupationfield.setBounds(424, 485, 400, 40);
+ getContentPane().add(motheroccupationfield);
+
+ filesizenote = new JLabel("Image size < 1024 KB");
+ filesizenote.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ filesizenote.setBounds(134, 624, 545, 32);
+ getContentPane().add(filesizenote);
+
+ filesize = new JLabel("");
+ filesize.setToolTipText("Image Size");
+ filesize.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ filesize.setBounds(200, 544, 566, 32);
+ getContentPane().add(filesize);
+
+ profilepiclabel = new JLabel();
+ profilepiclabel.setToolTipText("Profile Picture");
+ profilepiclabel.setBorder(new LineBorder(new Color(0, 0, 0)));
+ profilepiclabel.setFont(new Font("Segoe UI Historic", Font.PLAIN, 16));
+ profilepiclabel.setBounds(10, 536, 100, 120);
+ getContentPane().add(profilepiclabel);
+ profilepiclabel.setIcon(new ImageIcon("./assets/profilepicicon.jpg"));
+
+ choosefilebutton = new JButton("Choose File");
+ choosefilebutton.addActionListener(this);
+ choosefilebutton.setFocusable(false);
+ choosefilebutton.setBackground(new Color(245, 245, 245));
+ choosefilebutton.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ choosefilebutton.setBounds(134, 582, 114, 32);
+ choosefilebutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ getContentPane().add(choosefilebutton);
+
+ lblPhoto = new JLabel("Photo");
+ lblPhoto.setFont(new Font("Segoe UI Historic", Font.PLAIN, 18));
+ lblPhoto.setBounds(136, 548, 73, 21);
+ getContentPane().add(lblPhoto);
+
+ filename = new JLabel("No file choosen");
+ filename.setToolTipText("File Name");
+ filename.setFont(new Font("Tahoma", Font.PLAIN, 14));
+ filename.setBounds(258, 582, 566, 32);
+ getContentPane().add(filename);
+
+ addstudentbutton = new JButton("Add Student");
+ addstudentbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ addstudentbutton.setForeground(new Color(255, 255, 255));
+ addstudentbutton.setBackground(new Color(32, 178, 170));
+ addstudentbutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ addstudentbutton.addActionListener(this);
+ addstudentbutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ addstudentbutton.setBounds(685, 613, 139, 37);
+ addstudentbutton.setFocusable(false);
+ getContentPane().add(addstudentbutton);
+
+ Errorlabel = new JLabel("This is required question !");
+ Errorlabel.setBorder(new MatteBorder(0, 0, 0, 0, (Color) new Color(255, 0, 0)));
+ Errorlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ Errorlabel.setForeground(new Color(255, 69, 0));
+ Errorlabel.setFont(new Font("Calibri", Font.PLAIN, 16));
+ Errorlabel.setVisible(false);
+ Errorlabel.setBounds(10, 90, 400, 26);
+ getContentPane().add(Errorlabel);
+
+ }
+
+ public AddStudentDialog(AdminMain am, Student s) {
+ this();
+ this.am = am;
+ this.student = s;
+ courcenamecombo.setSelectedItem(s.getCourceName());
+ semoryearcombo.setSelectedIndex(s.getSemorYear());
+ rollnumberfield.setText(s.getRollNumber() + "");
+ rollnumberfield.setEditable(false);
+ optionalsubjectcombo.setSelectedItem(s.getOptionalSubject());
+ firstnamefield.setText(s.getFirstName());
+ lastnamefield.setText(s.getLastName());
+ emailidfield.setText(s.getEmailId());
+ contactnumberfield.setText(s.getContactNumber());
+ birthdatespinner.setValue(s.getBirthDateInDateFormat());
+
+ gendercombo.setSelectedItem(s.getGender()+"");
+ statefield.setText(s.getState());
+ cityfield.setText(s.getCity());
+ fathernamefield.setText(s.getFatherName());
+ fatheroccupationfield.setText(s.getFatherOccupation());
+ mothernamefield.setText(s.getMotherName());
+ motheroccupationfield.setText(s.getMotherOccupation());
+ profilepiclabel.setIcon(new ImageIcon(s.getProfilePic(100, 120)));
+ headerlabel.setText("Edit Student Details");
+ addstudentbutton.setText("Update Student");
+ courcenamecombo.setEnabled(false);
+ semoryearcombo.setEnabled(false);
+ rollnumberfield.setEditable(false);
+// optionalsubjectcombo.setEnabled(false);
+ courcenamecombo.setRenderer(new DefaultListCellRenderer() {
+ @Override
+ public void paint(Graphics g) {
+ setForeground(Color.BLACK);
+ setBackground(Color.WHITE);
+ super.paint(g);
+ }
+ });
+ semoryearcombo.setRenderer(new DefaultListCellRenderer() {
+ @Override
+ public void paint(Graphics g) {
+ setForeground(Color.BLACK);
+ setBackground(Color.WHITE);
+ super.paint(g);
+ }
+ });
+
+ }
+
+ public AddStudentDialog(JTable table, StudentPanel studentpanel) {
+ this();
+ this.sp = studentpanel;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ Errorlabel.setVisible(false);
+ Errorlabel.setText("This is required question !");
+ if (e.getSource() == choosefilebutton)
+ {
+
+ FileDialog fd = new FileDialog(this, "Choose a Profile pic", FileDialog.LOAD);
+ fd.setDirectory(".\\Students Profile pic");
+ fd.setFile("*.jpeg;*.jpg;*.png;*.tiff;*.tif;*.gif;");
+ fd.setLocationRelativeTo(null);
+ fd.setVisible(true);
+ String strfilename = fd.getFile();
+ imagepath = fd.getDirectory() + strfilename;
+ if (!imagepath.isEmpty())
+ {
+ file = new File(imagepath);
+ }
+
+ if (file.getAbsolutePath().contains("null"))
+ {
+ file = new File("./assets/profilepicicon.jpg");
+ }
+ if (strfilename == null)
+ {
+
+ }
+ else
+ {
+ long bytes = file.length();
+ if (bytes < 1048576) {
+
+ try
+ {
+ filesize.setText(bytes / 1024 + " KB");
+ filesizenote.setForeground(new Color(46, 139, 27));
+ filesizenote.setText("Image size < 1024 KB");
+ Image image = ImageIO.read(file).getScaledInstance(100, 120, Image.SCALE_SMOOTH);
+ profilepiclabel.setIcon(new ImageIcon(image));
+ }
+ catch (IOException ex) {
+ // TODO Auto-generated catch block
+ profilepiclabel.setIcon(new ImageIcon("./assets/profilepicicon.jpg"));
+ filename.setText("No file Choosen");
+ filesize.setText("");
+ filesizenote.setForeground(Color.red);
+ filesizenote.setText("Image Not supported");
+ ex.printStackTrace();
+ }
+ filename.setText(file.getName());
+ }
+ else {
+ profilepiclabel.setIcon(new ImageIcon("./assets/profilepicicon.jpg"));
+ filename.setText("No File Choosen");
+ filesize.setText("");
+ filesizenote.setForeground(Color.red);
+ filesizenote.setText("Image size is greater than 1 MB");
+ }
+
+ }
+ }
+
+ if (e.getSource() == courcenamecombo)
+ {
+ courcenamecombo.setFocusable(false);
+ rollnumberfield.setText("");
+ rollnumberfield.setEditable(true);
+ optionalsubjectcombo.setModel(new DefaultComboBoxModel(new String[] { "" }));
+ rollnumberfield.setText("");
+ if (courcenamecombo.getSelectedIndex() == 0)
+ {
+ semoryearcombo.setModel(new DefaultComboBoxModel(new String[] { "" }));
+
+ }
+ else
+ {
+ String cource = (String) courcenamecombo.getSelectedItem();
+ semoryearcombo.setModel(new DefaultComboBoxModel(new CourceData().getSemorYear(cource)));
+ }
+
+ }
+ if (e.getSource() == semoryearcombo && semoryearcombo.getSelectedIndex() > 0)
+ {
+ String courcecode = new CourceData().getCourcecode(courcenamecombo.getSelectedItem() + "");
+ int sem = semoryearcombo.getSelectedIndex();
+ long rollnumber = 0;
+ if (student != null && courcecode.equals(student.getCourceCode()) && sem == student.getSemorYear())
+ {
+ rollnumber = student.getRollNumber();
+
+ }
+ else
+ {
+ rollnumber = new RollNumberData().getRollNumber(courcecode, sem);
+ }
+ if (rollnumber == 0)
+ {
+ rollnumberfield.setText("");
+ rollnumberfield.setEditable(true);
+
+ }
+ else
+ {
+ rollnumberfield.setText(rollnumber + "");
+ rollnumberfield.setEditable(false);
+
+ }
+ String[] totalopsub = new SubjectData().getOptionalSubject(courcecode, sem);
+ if (totalopsub != null)
+ {
+ optionalsubjectcombo.setModel(new DefaultComboBoxModel(totalopsub));
+ }
+ else
+ {
+ optionalsubjectcombo.setModel(new DefaultComboBoxModel(new String[] { "No Optional Subject" }));
+
+ }
+ }
+
+ if (e.getSource() == addstudentbutton)
+ {
+
+ if (courcenamecombo.getSelectedIndex() == 0)
+ {
+ Errorlabel.setVisible(true);
+ Errorlabel.setBounds(courcenamecombo.getX(), courcenamecombo.getY() + courcenamecombo.getHeight(), 400,
+ 26);
+ }
+ else if (semoryearcombo.getSelectedIndex() == 0)
+ {
+ Errorlabel.setVisible(true);
+ Errorlabel.setBounds(semoryearcombo.getX(), semoryearcombo.getY() + semoryearcombo.getHeight(), 400,
+ 26);
+ }
+ else if (rollnumberfield.getText().isEmpty())
+ {
+ Errorlabel.setVisible(true);
+ Errorlabel.setBounds(rollnumberfield.getX(), rollnumberfield.getY() + rollnumberfield.getHeight(), 400,
+ 26);
+ }
+
+ else if (optionalsubjectcombo.getSelectedIndex() == 0
+ && !optionalsubjectcombo.getSelectedItem().toString().equals("No Optional Subject"))
+ {
+ Errorlabel.setVisible(true);
+ Errorlabel.setBounds(optionalsubjectcombo.getX(),
+ optionalsubjectcombo.getY() + optionalsubjectcombo.getHeight(), 400, 26);
+ }
+ else if (firstnamefield.getText().isEmpty())
+ {
+ Errorlabel.setVisible(true);
+ Errorlabel.setBounds(firstnamefield.getX(), firstnamefield.getY() + firstnamefield.getHeight(), 400,
+ 26);
+ }
+ else if (lastnamefield.getText().isEmpty())
+ {
+ Errorlabel.setVisible(true);
+ Errorlabel.setBounds(lastnamefield.getX(), lastnamefield.getY() + lastnamefield.getHeight(), 400, 26);
+ }
+ else if (emailidfield.getText().isEmpty())
+ {
+ Errorlabel.setVisible(true);
+ Errorlabel.setBounds(emailidfield.getX(), emailidfield.getY() + emailidfield.getHeight(), 400, 26);
+ }
+ else if (contactnumberfield.getText().isEmpty())
+ {
+ Errorlabel.setVisible(true);
+ Errorlabel.setBounds(contactnumberfield.getX(),contactnumberfield.getY() + contactnumberfield.getHeight(), 400, 26);
+ }
+ else if (gendercombo.getSelectedIndex() == 0)
+ {
+ Errorlabel.setVisible(true);
+ Errorlabel.setBounds(gendercombo.getX(), gendercombo.getY() + gendercombo.getHeight(), 400, 26);
+ }
+ else if (statefield.getText().isEmpty())
+ {
+ Errorlabel.setVisible(true);
+ Errorlabel.setBounds(statefield.getX(), statefield.getY() + statefield.getHeight(), 400, 26);
+ }
+ else if (cityfield.getText().isEmpty())
+ {
+ Errorlabel.setVisible(true);
+ Errorlabel.setBounds(cityfield.getX(), cityfield.getY() + cityfield.getHeight(), 400, 26);
+ }
+ else if (fathernamefield.getText().isEmpty())
+ {
+ Errorlabel.setVisible(true);
+ Errorlabel.setBounds(fathernamefield.getX(), fathernamefield.getY() + fathernamefield.getHeight(), 400,26);
+ }
+ else if (fatheroccupationfield.getText().isEmpty())
+ {
+ Errorlabel.setVisible(true);
+ Errorlabel.setBounds(fatheroccupationfield.getX(),fatheroccupationfield.getY() + fatheroccupationfield.getHeight(), 400, 26);
+ }
+ else if (mothernamefield.getText().isEmpty())
+ {
+ Errorlabel.setVisible(true);
+ Errorlabel.setBounds(mothernamefield.getX() + 120, mothernamefield.getY() + mothernamefield.getHeight(),400, 26);
+ }
+ else if (motheroccupationfield.getText().isEmpty()|| motheroccupationfield.getText().equals(" Mother Occupation"))
+ {
+ Errorlabel.setVisible(true);
+ Errorlabel.setBounds(motheroccupationfield.getX(),motheroccupationfield.getY() + motheroccupationfield.getHeight(), 400, 26);
+ }
+ else {
+ try
+ {
+ Student s = new Student();
+
+ s.setCourceCode(new CourceData().getCourcecode(courcenamecombo.getSelectedItem() + ""));
+ s.setSemorYear(semoryearcombo.getSelectedIndex());
+ s.setRollNumber(Long.parseLong(rollnumberfield.getText()));
+ int rollnumberexist = new RollNumberData().isExist(s.getCourceCode(), s.getSemorYear(), s.getRollNumber());
+ if (rollnumberexist > 0)
+ {
+ if (student != null && student.getRollNumber()==s.getRollNumber())
+ {
+
+ }
+ else
+ {
+ throw new RollNumberAvailableException();
+ }
+
+ }
+ s.setOptionalSubject(optionalsubjectcombo.getSelectedItem().toString());
+ s.setFirstName(firstnamefield.getText());
+ s.setLastName(lastnamefield.getText());
+ s.setEmailId(emailidfield.getText());
+ s.setContactNumber(contactnumberfield.getText());
+
+ s.setGender(gendercombo.getSelectedItem() + "");
+ Date date = (Date) birthdatespinner.getValue();
+ s.setBirthDate(new SimpleDateFormat("dd-MM-yyyy").format(date));
+ s.setState(statefield.getText());
+ s.setCity(cityfield.getText());
+ s.setFatherName(fathernamefield.getText());
+ s.setMotherName(mothernamefield.getText());
+ s.setFatherOccupation(fatheroccupationfield.getText());
+ s.setMotherOccupation(motheroccupationfield.getText());
+ s.generateAdmissionDate();
+ s.generateUserId();
+ if(student!=null)
+ {
+ s.setPassword(student.getPassword());
+ s.setAdmissionDate(student.getAdmissionDate());
+ s.setLastLogin(student.getLastLogin());
+ }
+ if (student != null && file.getAbsolutePath().equals("C:\\Users\\Sohansinh Rathod\\eclipse-workspace\\Collage Data Management\\.\\assets\\profilepicicon.jpg")) {
+ s.setProfilePic(student.getProfilePic());
+ }
+ else {
+
+ s.setProfilePic(ImageIO.read(file));
+
+ }
+ int result = 0;
+ if (sp != null)
+ {
+ result = new StudentData().addStudent(s);
+ }
+ else if (am != null && student != null)
+ {
+ result = new StudentData().updateStudentData(student, s);
+ }
+ if (result > 0) {
+
+
+ if (sp != null)
+ {
+ if (sp.photoviewscrollpane != null && sp.photoviewscrollpane.isVisible())
+ {
+ sp.createtablemodel();
+ sp.createphotopanel();
+ }
+ else
+ {
+ sp.createtablemodel();
+ }
+
+ }
+ else if (am != null && student != null) {
+
+ am.viewstudentpanel.setVisible(false);
+ am.viewstudentpanel = new ViewStudentPanel(s, am, am.viewstudentpanel.lastpanel);
+ am.viewstudentpanel.setVisible(true);
+ am.viewstudentpanel.setLocation(am.panelx, am.panely);
+ am.getContentPane().add(am.viewstudentpanel);
+
+ }
+ this.dispose();
+ }
+
+ } catch (NumberFormatException exp) {
+ Errorlabel.setVisible(true);
+ Errorlabel.setText("Characters are not allowed!");
+ Errorlabel.setBounds(rollnumberfield.getX(), rollnumberfield.getY() + rollnumberfield.getHeight(),
+ 400, 26);
+ } catch (RollNumberAvailableException exp) {
+ Errorlabel.setVisible(true);
+ Errorlabel.setText("RollNumber already Exist...!");
+ Errorlabel.setBounds(rollnumberfield.getX(), rollnumberfield.getY() + rollnumberfield.getHeight(),
+ 400, 26);
+ exp.printStackTrace();
+
+ } catch (Exception e1) {
+
+ // TODO Auto-generated catch block
+
+ e1.printStackTrace();
+ }
+ }
+ }
+
+ }
+
+}
+
+@SuppressWarnings("serial")
+class RollNumberAvailableException extends Exception {
+ public RollNumberAvailableException() {
+ super("Roll number already available");
+ }
+}
\ No newline at end of file
diff --git a/src/collegeapplication/student/Attandance.java b/src/collegeapplication/student/Attandance.java
new file mode 100644
index 0000000..c16cbb7
--- /dev/null
+++ b/src/collegeapplication/student/Attandance.java
@@ -0,0 +1,73 @@
+package collegeapplication.student;
+
+import collegeapplication.subject.Subject;
+
+/*
+ * Title : UserData.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : For binding all the data related to attandance
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+public class Attandance extends Subject
+{
+ private String studentname;
+ private String date;
+ private int attandance;
+ private int totalattandance;
+ private long rollnumber;
+ private boolean present;
+ public void setAttandanceDate(String date)
+ {
+ this.date=date;
+ }
+ public void setStudentName(String studentname)
+ {
+ this.studentname=studentname;
+ }
+ public void setAttandance(int attandance)
+ {
+ this.attandance=attandance;
+ }
+
+ public void setTotalAttandance(int totalattandance)
+ {
+ this.totalattandance=totalattandance;
+ }
+ public void setPresentStatus(boolean presentstatus)
+ {
+ this.present=presentstatus;
+ }
+ public void setRollNumber(long rollnumber)
+ {
+ this.rollnumber=rollnumber;
+ }
+ public String getStudentName()
+ {
+ return studentname;
+ }
+ public long getRollNumber()
+ {
+ return rollnumber;
+ }
+ public int getAttandance()
+ {
+ return attandance;
+ }
+ public int getTotalAttandance()
+ {
+ return totalattandance;
+ }
+ public String getAttandanceDate()
+ {
+ return date;
+ }
+ public boolean getPresentStatus()
+ {
+ return present;
+ }
+
+
+
+
+
+}
\ No newline at end of file
diff --git a/src/collegeapplication/student/AttandanceReportPanel.java b/src/collegeapplication/student/AttandanceReportPanel.java
new file mode 100644
index 0000000..4837efc
--- /dev/null
+++ b/src/collegeapplication/student/AttandanceReportPanel.java
@@ -0,0 +1,781 @@
+package collegeapplication.student;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Image;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+
+import javax.imageio.ImageIO;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.SwingConstants;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.LineBorder;
+import javax.swing.table.DefaultTableCellRenderer;
+import javax.swing.table.DefaultTableModel;
+
+import collegeapplication.admin.AdminMain;
+import collegeapplication.cource.CourceData;
+import collegeapplication.faculty.FacultyMain;
+import collegeapplication.subject.SubjectData;
+
+/*
+ * Title : AttandanceReportPanel.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : For displaying student attandance according to class/subject/student wice
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+public class AttandanceReportPanel extends JPanel implements ActionListener {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private JComboBox courcenamecombo;
+ private JComboBox semoryearcombo;
+ private JComboBox subjectorrollcombo;
+ private JTable table;
+ private JScrollPane scrollPane;
+ private int totalstudent=0;
+ private JLabel Errorlabel;
+ private JButton studentwicebutton;
+ private JButton classwicebutton;
+ private JButton subjectwicebutton;
+ private JButton fetchdetailsbutton;
+ private JLabel label3;
+ private JLabel label1;
+ private JLabel label2;
+ private JLabel nodatafoundlabel;
+ private JButton backbutton;
+ private JPanel panel;
+
+ /**
+ * Create the panel.
+ */
+ @Override
+ public Dimension getPreferredSize()
+ {
+ return new Dimension(1096,scrollPane.getY()+scrollPane.getHeight()+40);
+
+ }
+
+ private AttandanceReportPanel() {
+ setBorder(null);
+
+ setBackground(new Color(255, 255, 255));
+ this.setSize(1116, 544);
+ setLayout(null);
+ panel = new JPanel();
+ panel.setBackground(new Color(32, 178, 170));
+ panel.setBounds(10, 0, 1077, 183);
+ add(panel);
+ panel.setLayout(null);
+ JLabel headinglabel = new JLabel("Attandance Report");
+ headinglabel.setIcon(null);
+ headinglabel.setBounds(10, 65, 272, 44);
+ panel.add(headinglabel);
+ headinglabel.setBackground(new Color(32, 178, 170));
+ headinglabel.setHorizontalAlignment(SwingConstants.LEFT);
+ headinglabel.setForeground(Color.WHITE);
+ headinglabel.setFont(new Font("Segoe UI", Font.BOLD, 28));
+ headinglabel.setOpaque(true);
+
+ subjectwicebutton = new JButton("Subject Wice");
+ subjectwicebutton.setForeground(new Color(0, 139, 139));
+ subjectwicebutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ subjectwicebutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ subjectwicebutton.setBackground(new Color(255, 255, 255));
+ subjectwicebutton.setBounds(577, 139, 146, 33);
+
+ panel.add(subjectwicebutton);
+
+ studentwicebutton = new JButton("Student Wice");
+ studentwicebutton.setForeground(new Color(0, 139, 139));
+ studentwicebutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ studentwicebutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ studentwicebutton.setBackground(Color.WHITE);
+ studentwicebutton.setBounds(742, 139, 146, 33);
+
+ panel.add(studentwicebutton);
+
+ classwicebutton = new JButton("Class Wice");
+ classwicebutton.setForeground(new Color(0, 139, 139));
+ classwicebutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ classwicebutton.setBackground(Color.WHITE);
+ classwicebutton.setBounds(907, 139, 146, 33);
+ classwicebutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+
+ panel.add(classwicebutton);
+
+ label1 = new JLabel("Cource Name :");
+ label1.setHorizontalAlignment(SwingConstants.RIGHT);
+ label1.setForeground(Color.DARK_GRAY);
+ label1.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ label1.setBounds(29, 213, 163, 37);
+ add(label1);
+
+ label2 = new JLabel("Semester or Years :");
+ label2.setHorizontalAlignment(SwingConstants.RIGHT);
+ label2.setForeground(Color.DARK_GRAY);
+ label2.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ label2.setBounds(23, 270, 169, 40);
+ add(label2);
+
+ label3 = new JLabel("Select Subject :");
+ label3.setHorizontalAlignment(SwingConstants.RIGHT);
+ label3.setForeground(Color.DARK_GRAY);
+ label3.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ label3.setBounds(29, 339, 163, 32);
+ add(label3);
+
+ courcenamecombo = new JComboBox(new CourceData().getCourceName());
+
+ courcenamecombo.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ courcenamecombo.addActionListener(this);
+ courcenamecombo.setFocusable(false);
+ courcenamecombo.setBackground(new Color(255, 255, 255));
+ courcenamecombo.setBounds(204, 211, 872, 40);
+ add(courcenamecombo);
+
+ semoryearcombo = new JComboBox();
+ semoryearcombo.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ semoryearcombo.setBackground(Color.WHITE);
+ semoryearcombo.setBounds(204, 270, 872, 40);
+ semoryearcombo.addActionListener(this);
+ semoryearcombo.setFocusable(false);
+
+ add(semoryearcombo);
+ subjectorrollcombo = new JComboBox();
+ subjectorrollcombo.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ subjectorrollcombo.setFocusable(false);
+ subjectorrollcombo.addActionListener(this);
+ subjectorrollcombo.setBackground(Color.WHITE);
+ subjectorrollcombo.setBounds(204, 335, 872, 40);
+ add(subjectorrollcombo);
+
+ scrollPane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_NEVER,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ scrollPane.setBounds(21, 460, 1055, 84);
+ for(Component c:scrollPane.getComponents())
+ {
+ c.setBackground(Color.white);
+ }
+ add(scrollPane);
+ scrollPane.setVisible(false);
+ table = new JTable();
+ table.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ table.setForeground(new Color(0, 0, 0));
+ table.setRowHeight(40);
+ table.getTableHeader().setBackground(new Color(32,178,170));
+ table.getTableHeader().setForeground(Color.white);
+ table.getTableHeader().setFont(new Font("Arial",Font.BOLD,20));
+ table.setFont(new Font("Segoe UI",Font.PLAIN,20));
+ table.getTableHeader().setPreferredSize(new Dimension(50,40));
+ table.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ table.setDragEnabled(false);
+ table.setFocusable(false);
+ table.setGridColor(Color.LIGHT_GRAY);
+ table.getTableHeader().setReorderingAllowed(false);
+
+ scrollPane.setViewportView(table);
+ Errorlabel = new JLabel("This is required question !");
+ Errorlabel.setVisible(false);
+ Errorlabel.setForeground(Color.RED);
+ Errorlabel.setFont(new Font("Arial", Font.PLAIN, 14));
+ Errorlabel.setBounds(233, 45, 225, 17);
+ add(Errorlabel);
+ enableButton(subjectwicebutton);
+ disableButton(studentwicebutton);
+ disableButton(classwicebutton);
+
+ fetchdetailsbutton = new JButton("Fetch Details");
+ fetchdetailsbutton.setName("Active");
+ fetchdetailsbutton.setForeground(Color.WHITE);
+ fetchdetailsbutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ fetchdetailsbutton.setFocusPainted(false);
+ fetchdetailsbutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ fetchdetailsbutton.addActionListener(this);
+ fetchdetailsbutton.setBorder(new LineBorder(new Color(255, 255, 255)));
+ fetchdetailsbutton.setBackground(new Color(32, 178, 170));
+ fetchdetailsbutton.setBounds(926, 399, 151, 37);
+ add(fetchdetailsbutton);
+
+ nodatafoundlabel=new JLabel("");
+ nodatafoundlabel.setHorizontalAlignment(SwingConstants.CENTER);
+ try
+ {
+
+ Image image= ImageIO.read(new File("./assets/notfound2.png"));
+ nodatafoundlabel.setIcon(new ImageIcon(image.getScaledInstance(150, 150, Image.SCALE_SMOOTH)));
+
+ } catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ nodatafoundlabel.setText("No Data Found...!");
+ nodatafoundlabel.setVerticalTextPosition(JLabel.BOTTOM);
+ nodatafoundlabel.setBorder(null);
+ nodatafoundlabel.setBackground(new Color(245, 245, 245));
+ nodatafoundlabel.setFont(new Font("Tahoma", Font.PLAIN, 17));
+ nodatafoundlabel.setHorizontalTextPosition(JLabel.CENTER);
+ nodatafoundlabel.setIconTextGap(20);
+ nodatafoundlabel.setVisible(false);
+ nodatafoundlabel.setBounds(300, 380, 480, 321);
+ add(nodatafoundlabel);
+
+ }
+ public void enableButton(JButton button)
+ {
+ button.setBorder(new LineBorder(new Color(255, 255, 255)));
+ button.setForeground(new Color(0, 139, 139));
+ button.setBackground(new Color(255, 255, 255));
+ button.setFocusPainted(false);
+ button.setName("Active");
+ }
+ public void disableButton(JButton button)
+ {
+
+ button.setBorder(new LineBorder(new Color(255, 255, 255)));
+ button.setForeground(new Color(255, 255, 255));
+ button.setBackground(new Color(32, 178, 170));
+ button.setFocusPainted(false);
+ button.setName("Deactive");
+ }
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ Errorlabel.setVisible(false);
+ if(e.getSource()==courcenamecombo)
+ {
+ courcenamecombo.setFocusable(false);
+
+ subjectorrollcombo.setModel(new DefaultComboBoxModel(new String[] {""}));
+ if(courcenamecombo.getSelectedIndex()==0)
+ {
+ semoryearcombo.setModel(new DefaultComboBoxModel(new String[] {""}));
+
+ }
+ else
+ {
+ String cource=(String) courcenamecombo.getSelectedItem();
+
+ semoryearcombo.setModel(new DefaultComboBoxModel(new CourceData().getSemorYear(cource)));
+ }
+
+ }
+ if(e.getSource()==semoryearcombo && semoryearcombo.getSelectedIndex()>0)
+ {
+ String cource=(String) courcenamecombo.getSelectedItem();
+
+ if(subjectwicebutton.getName().equals("Active"))
+ {
+ String[] totalsub=new SubjectData().getSubjectinCource(new CourceData().getCourcecode(cource), semoryearcombo.getSelectedIndex());
+ if(totalsub!=null)
+ {
+ subjectorrollcombo.setModel(new DefaultComboBoxModel(totalsub));
+ }
+ else
+ {
+
+ subjectorrollcombo.setModel(new DefaultComboBoxModel(new String[] {"No Subject Found"}));
+ }
+ }
+ else if(studentwicebutton.getName().equals("Active"))
+ {
+
+
+ subjectorrollcombo.setModel(new DefaultComboBoxModel(new StudentData().getRollNumber(new CourceData().getCourcecode(cource), semoryearcombo.getSelectedIndex())));
+
+ }
+ }
+ else if(e.getSource()==semoryearcombo)
+ {
+ subjectorrollcombo.setModel(new DefaultComboBoxModel(new String[] {""}));
+ }
+ if(e.getSource()==fetchdetailsbutton)
+ {
+ if(courcenamecombo.getSelectedIndex()==0)
+ {
+ showerror(courcenamecombo);
+ }
+ else if(semoryearcombo.getSelectedIndex()==0)
+ {
+ showerror(semoryearcombo);
+ }
+ else if(subjectorrollcombo.isVisible() && subjectorrollcombo.getSelectedItem().equals("No Subject Found"))
+ {
+ Component tf=subjectorrollcombo;
+ Errorlabel.setVisible(true);
+ Errorlabel.setText("No Subject Found !");
+ Errorlabel.setBounds(tf.getX(), tf.getY()+tf.getHeight()-5, 400,26);
+ }
+ else if(subjectorrollcombo.isVisible() && subjectorrollcombo.getSelectedIndex()==0)
+ {
+ showerror(subjectorrollcombo);
+ }
+
+ else
+ {
+ this.createtablemodel();
+ }
+ }
+ // TODO Auto-generated method stub
+
+ }
+ public void showerror(JComponent tf)
+ {
+ Errorlabel.setVisible(true);
+ Errorlabel.setText("This is required question !");
+ Errorlabel.setBounds(tf.getX(), tf.getY()+tf.getHeight()-5, 400,26);
+ }
+
+ public AttandanceReportPanel(AdminMain am)
+ {
+ this();
+ table.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ if(e.getClickCount()>1 && e.getButton()==MouseEvent.BUTTON1)
+ {
+
+ JTable t=(JTable) e.getSource();
+ int row=t.getSelectedRow();
+
+ String strsem=table.getValueAt(row, 2)+"";
+ int sem=Integer.parseInt(strsem.substring(strsem.indexOf('-')+1));
+ String courcecode=strsem.substring(0,strsem.indexOf('-'));
+ String strroll=table.getValueAt(row, 0)+"";
+ long rollnumber=Long.parseLong(strroll);
+ Student s=new StudentData().getStudentDetails(courcecode,sem,rollnumber);
+
+ am.viewstudentpanel=new ViewStudentPanel(s,am,am.attandancereportpanelscroll);
+ am.viewstudentpanel.setVisible(true);
+ am.attandancereportpanelscroll.setVisible(false);
+ am.viewstudentpanel.setLocation(am.panelx,0);
+ am.viewstudentpanel.setVisible(true);
+ am.viewstudentpanel.setFocusable(true);
+ am.contentPane.add(am.viewstudentpanel);
+ }
+
+ }
+ });
+ subjectwicebutton.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ enableButton(subjectwicebutton);
+ disableButton(studentwicebutton);
+ disableButton(classwicebutton);
+ subjectorrollcombo.setVisible(true);
+ label3.setVisible(true);
+ fetchdetailsbutton.setLocation(fetchdetailsbutton.getX(),subjectorrollcombo.getY()+65);
+ scrollPane.setLocation(scrollPane.getX(), fetchdetailsbutton.getY()+60);
+ label3.setText("Select Subject :");
+ subjectorrollcombo.setModel(new DefaultComboBoxModel(new String[] {""}));
+ courcenamecombo.setSelectedIndex(0);
+ semoryearcombo.setModel(new DefaultComboBoxModel(new String[]{""}));
+ scrollPane.setVisible(false);
+ }
+
+ }
+ );
+ studentwicebutton.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ // TODO Auto-generated method stub
+ enableButton(studentwicebutton);
+ disableButton(subjectwicebutton);
+ disableButton(classwicebutton);
+ label3.setVisible(true);
+ subjectorrollcombo.setVisible(true);
+ label3.setText("Select Roll Number :");
+ fetchdetailsbutton.setLocation(fetchdetailsbutton.getX(),subjectorrollcombo.getY()+65);
+ scrollPane.setLocation(scrollPane.getX(), fetchdetailsbutton.getY()+60);
+ subjectorrollcombo.setModel(new DefaultComboBoxModel(new String[] {""}));
+ courcenamecombo.setSelectedIndex(0);
+ semoryearcombo.setModel(new DefaultComboBoxModel(new String[]{""}));
+ scrollPane.setVisible(false);
+
+ }
+
+ }
+ );
+ classwicebutton.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ // TODO Auto-generated method stub
+ enableButton(classwicebutton);
+ disableButton(studentwicebutton);
+ disableButton(subjectwicebutton);
+ subjectorrollcombo.setVisible(false);
+ label3.setVisible(false);
+ fetchdetailsbutton.setLocation(fetchdetailsbutton.getX(),subjectorrollcombo.getY());
+ scrollPane.setLocation(scrollPane.getX(), fetchdetailsbutton.getY()+60);
+ courcenamecombo.setSelectedIndex(0);
+ semoryearcombo.setModel(new DefaultComboBoxModel(new String[]{""}));
+ scrollPane.setVisible(false);
+ }
+
+ }
+ );
+
+ }
+ public AttandanceReportPanel(FacultyMain fm)
+ {
+
+ this();
+
+ courcenamecombo.setSelectedItem(new CourceData().getcourcename(fm.f.getCourceCode()));
+ semoryearcombo.setModel(new DefaultComboBoxModel(new CourceData().getSemorYear(courcenamecombo.getSelectedItem()+"")));
+ String[] totalsub=new SubjectData().getSubjectinCource(fm.f.getCourceCode(), fm.f.getSemorYear());
+ subjectorrollcombo.setModel(new DefaultComboBoxModel(totalsub));
+ semoryearcombo.setSelectedIndex(fm.f.getSemorYear());
+ subjectorrollcombo.setSelectedItem(fm.f.getSubject());
+ courcenamecombo.setVisible(false);
+ semoryearcombo.setVisible(false);
+ label3.setLocation(label1.getLocation());
+ label1.setVisible(false);
+ label2.setVisible(false);
+ subjectorrollcombo.setLocation(courcenamecombo.getLocation());
+ this.fetchdetailsbutton.setLocation(fetchdetailsbutton.getX(),semoryearcombo.getY());
+ scrollPane.setLocation(scrollPane.getX(),fetchdetailsbutton.getY()+50);
+ table.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ if(e.getClickCount()>1 && e.getButton()==MouseEvent.BUTTON1)
+ {
+
+ JTable t=(JTable) e.getSource();
+ int row=t.getSelectedRow();
+
+ String strsem=table.getValueAt(row, 2)+"";
+ int sem=Integer.parseInt(strsem.substring(strsem.indexOf('-')+1));
+ String courcecode=strsem.substring(0,strsem.indexOf('-'));
+ String strroll=table.getValueAt(row, 0)+"";
+ long rollnumber=Long.parseLong(strroll);
+ Student s=new StudentData().getStudentDetails(courcecode,sem,rollnumber);
+
+ fm.viewstudentpanel=new ViewStudentPanel(s,fm,fm.attandancereportpanelscroll);
+ fm.viewstudentpanel.setVisible(true);
+ fm.attandancereportpanelscroll.setVisible(false);
+ fm.viewstudentpanel.setLocation(fm.panelx,0);
+ fm.viewstudentpanel.setVisible(true);
+ fm.viewstudentpanel.setFocusable(true);
+ fm.contentPane.add(fm.viewstudentpanel);
+ }
+
+ }
+ });
+ studentwicebutton.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ // TODO Auto-generated method stub
+ enableButton(studentwicebutton);
+ disableButton(subjectwicebutton);
+ disableButton(classwicebutton);
+ label3.setVisible(true);
+ subjectorrollcombo.setVisible(true);
+ label3.setText("Select Roll Number :");
+ fetchdetailsbutton.setVisible(true);
+ subjectorrollcombo.setLocation(courcenamecombo.getLocation());
+ fetchdetailsbutton.setLocation(fetchdetailsbutton.getX(),semoryearcombo.getY());
+ scrollPane.setLocation(scrollPane.getX(),fetchdetailsbutton.getY()+50);
+ subjectorrollcombo.setModel(new DefaultComboBoxModel(new StudentData().getRollNumber(fm.f.getCourceCode(), semoryearcombo.getSelectedIndex())));
+ scrollPane.setVisible(false);
+
+ }
+
+ }
+ );
+ subjectwicebutton.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ // TODO Auto-generated method stub
+ enableButton(subjectwicebutton);
+ disableButton(studentwicebutton);
+ disableButton(classwicebutton);
+ label3.setVisible(true);
+ subjectorrollcombo.setVisible(true);
+ label3.setText("Select Subject :");
+ fetchdetailsbutton.setVisible(true);
+ subjectorrollcombo.setLocation(courcenamecombo.getLocation());
+ fetchdetailsbutton.setLocation(fetchdetailsbutton.getX(),semoryearcombo.getY());
+ scrollPane.setLocation(scrollPane.getX(),fetchdetailsbutton.getY()+50);
+ String[] totalsub=new SubjectData().getSubjectinCource(fm.f.getCourceCode(), fm.f.getSemorYear());
+ subjectorrollcombo.setModel(new DefaultComboBoxModel(totalsub));
+ scrollPane.setVisible(false);
+
+ }
+
+ }
+ );
+ classwicebutton.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ // TODO Auto-generated method stub
+ subjectwicebutton.setName("Active");
+ enableButton(classwicebutton);
+ disableButton(studentwicebutton);
+ disableButton(subjectwicebutton);
+ subjectorrollcombo.setVisible(false);
+ label3.setVisible(false);
+ scrollPane.setLocation(scrollPane.getX(), courcenamecombo.getY());
+ fetchdetailsbutton.setVisible(false);
+ createtablemodel();
+ }
+
+ }
+ );
+
+ }
+ public AttandanceReportPanel(StudentMain sm,JComponent lastpanel)
+ {
+ this(sm);
+ backbutton = new JButton("Back");
+ backbutton.setContentAreaFilled(false);
+ backbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ backbutton.setIcon(new ImageIcon(".\\assets\\back.png"));
+ backbutton.setFocusable(false);
+ backbutton.setForeground(Color.WHITE);
+ backbutton.setFont(new Font("Segoe UI", Font.BOLD, 16));
+ backbutton.setBackground(new Color(32, 178, 170));
+ backbutton.setBounds(10, 141, 88, 36);
+ panel.add(backbutton);
+
+ backbutton.addActionListener(e->
+ {
+ sm.attandancereportpanelscroll.setVisible(false);
+ lastpanel.setVisible(true);
+ });
+ }
+ public AttandanceReportPanel(StudentMain sm)
+ {
+ this();
+ classwicebutton.setVisible(false);
+ studentwicebutton.setVisible(false);
+ subjectwicebutton.setVisible(false);
+ label1.setVisible(false);
+ label2.setVisible(false);
+ label3.setVisible(false);
+ courcenamecombo.setVisible(false);
+ subjectorrollcombo.setVisible(false);
+ semoryearcombo.setVisible(false);
+ this.fetchdetailsbutton.setVisible(false);
+ enableButton(studentwicebutton);
+ disableButton(subjectwicebutton);
+ disableButton(classwicebutton);
+
+ courcenamecombo.setSelectedItem(new CourceData().getcourcename(sm.s.getCourceCode()));
+ semoryearcombo.setModel(new DefaultComboBoxModel(new CourceData().getSemorYear(courcenamecombo.getSelectedItem()+"")));
+ subjectorrollcombo.setModel(new DefaultComboBoxModel(new StudentData().getRollNumber(sm.s.getCourceCode(), sm.s.getSemorYear())));
+ semoryearcombo.setSelectedIndex(sm.s.getSemorYear());
+ subjectorrollcombo.setSelectedItem(sm.s.getRollNumber()+"");
+ scrollPane.setLocation(scrollPane.getX(),courcenamecombo.getY());
+ scrollPane.setVisible(true);
+
+ this.createtablemodel();
+ table.setEnabled(false);
+ table.setRowSelectionInterval(totalstudent-1, totalstudent-1);
+ table.getColumnModel().getColumn(0).setCellRenderer(new CellRenderer());
+ table.getColumnModel().getColumn(1).setCellRenderer(new CellRenderer());
+ table.getColumnModel().getColumn(2).setCellRenderer(new CellRenderer());
+ table.getColumnModel().getColumn(3).setCellRenderer(new CellRenderer());
+ table.getColumnModel().getColumn(4).setCellRenderer(new CellRenderer());
+ table.getColumnModel().getColumn(5).setCellRenderer(new CellRenderer());
+
+
+
+
+ }
+ public void createtablemodel()
+ {
+ nodatafoundlabel.setVisible(false);
+ if(courcenamecombo.getSelectedIndex()==0||(semoryearcombo.isVisible()&&semoryearcombo.getSelectedIndex()==0)||(subjectorrollcombo.isVisible()&&subjectorrollcombo.getSelectedIndex()==0))
+ {
+ scrollPane.setVisible(false);
+ }
+ else
+ {
+ Attandance a=new Attandance();
+ a.setCourceCode(new CourceData().getCourcecode(courcenamecombo.getSelectedItem()+""));
+ a.setSemorYear(semoryearcombo.getSelectedIndex());
+ if(subjectwicebutton.getName().equals("Active"))
+ {
+ a.setSubjectName(subjectorrollcombo.getSelectedItem()+"");
+ a.setSubjectCode(new SubjectData().getSubjectCode(a.getCourceCode(), a.getSemorYear(), a.getSubjectName()));
+ }
+ else if(classwicebutton.getName().equals("Active"))
+ {
+ a.setSubjectName("All");
+ }
+ else if(studentwicebutton.getName().equals("Active"))
+ {
+ a.setRollNumber(Long.parseLong(subjectorrollcombo.getSelectedItem()+""));
+
+ }
+ table.setModel(createModel(a));
+ scrollPane.setSize(scrollPane.getWidth(), 40+(totalstudent*40));
+ this.setSize(1116, scrollPane.getY()+80+totalstudent*40+60);
+
+ table.getColumnModel().getColumn(0).setMaxWidth(200);
+ table.getColumnModel().getColumn(1).setMaxWidth(250);
+ table.getColumnModel().getColumn(2).setMaxWidth(200);
+ table.getColumnModel().getColumn(3).setMaxWidth(250);
+ table.getColumnModel().getColumn(4).setMaxWidth(230);
+ table.getColumnModel().getColumn(5).setMaxWidth(200);
+ DefaultTableCellRenderer cellrenderer=new DefaultTableCellRenderer();
+ cellrenderer.setHorizontalAlignment(JLabel.CENTER);
+ table.getColumnModel().getColumn(0).setCellRenderer(cellrenderer);
+ table.getColumnModel().getColumn(2).setCellRenderer(cellrenderer);
+ table.getColumnModel().getColumn(3).setCellRenderer(cellrenderer);
+ table.getColumnModel().getColumn(4).setCellRenderer(cellrenderer);
+ table.getColumnModel().getColumn(5).setCellRenderer(cellrenderer);
+ table.setSelectionBackground(new Color(240, 255, 255));
+ table.setSelectionForeground(Color.black);
+ table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
+ scrollPane.setVisible(true);
+ if(totalstudent==0)
+ {
+ noDataFound();
+ }
+ }
+
+ }
+ public DefaultTableModel createModel(Attandance a)
+ {
+ String Column[]= {"Roll Number","Student Name","Class","Subject","Total Attandance","Percentage"};
+
+ @SuppressWarnings("serial")
+ DefaultTableModel model=new DefaultTableModel(Column,0)
+ {
+ boolean isEdit[]= {false,false,false,false,false,false};
+ @Override
+ public boolean isCellEditable(int row,int column)
+ {
+ return isEdit[column];
+ }
+ };
+
+ ArrayList list=null;
+ if(studentwicebutton.getName().equals("Active"))
+ {
+ list=new StudentData().getAttandanceReportByStudent(a);
+ }
+ else if(subjectwicebutton.getName().equals("Active"))
+ {
+ list=new StudentData().getAttandanceReportBySubject(a);
+ }
+ else if(classwicebutton.getName().equals("Active"))
+ {
+ list=new StudentData().getAttandanceReportByClass(a);
+ }
+ for(int i=0; i courcenamecombo,semoryearcombo,subjectnamecombo;
+ private JLabel Errorlabel;
+ private JScrollPane scrollPane;
+ private JTable table;
+ private int totalstudent=0;
+ private JButton submitbutton;
+ private JButton theorymarksbutton;
+ private JButton practicalmarksbutton;
+ private JLabel TableErrorlabel;
+ private Timer timer;
+ private JLabel label3;
+ private JLabel label2;
+ private JLabel label1;
+ private JPanel selectcourcepanel;
+ private JLabel nodatafoundlabel;
+
+ /**
+ * Create the panel.
+ */
+
+ @Override
+ public Dimension getPreferredSize()
+ {
+
+ return new Dimension( 1116,this.getHeight());
+ }
+
+ public EnterMarksPanel(FacultyMain fm)
+ {
+ this();
+ courcenamecombo.setSelectedItem(fm.f.getCourceName());
+ semoryearcombo.setModel(new DefaultComboBoxModel(new CourceData().getSemorYear(courcenamecombo.getSelectedItem()+"")));
+ String[] totalsub=new SubjectData().getSubjectinCource(fm.f.getCourceCode(), fm.f.getSemorYear());
+ subjectnamecombo.setModel(new DefaultComboBoxModel(totalsub));
+ semoryearcombo.setSelectedIndex(fm.f.getSemorYear());
+ subjectnamecombo.setSelectedItem(fm.f.getSubject());
+ selectcourcepanel.setVisible(false);
+ this.createtablemodel();
+ scrollPane.setLocation(scrollPane.getX(),selectcourcepanel.getY());
+ submitbutton.setLocation(submitbutton.getX(), scrollPane.getY()+scrollPane.getHeight()+40);
+
+ }
+ public EnterMarksPanel() {
+
+ timer=new Timer(10000,this);
+ timer.start();
+ setBorder(null);
+ setBackground(new Color(255, 255, 255));
+ this.setSize(1116, 544);
+ setLayout(null);
+
+ JPanel panel = new JPanel();
+ panel.setBounds(10, 11, 1076, 117);
+ panel.setBackground(new Color(32, 178, 170));
+ add(panel);
+ panel.setLayout(null);
+
+
+ theorymarksbutton = new JButton("Theory Marks");
+ theorymarksbutton.setBorder(new LineBorder(new Color(255, 255, 255)));
+ theorymarksbutton.setForeground(new Color(0, 139, 139));
+ theorymarksbutton.setBackground(new Color(255, 255, 255));
+ theorymarksbutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ theorymarksbutton.setName("Active");
+ theorymarksbutton.addActionListener(this);
+ theorymarksbutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+
+ theorymarksbutton.setFocusable(false);
+ theorymarksbutton.setBounds(727, 69, 148, 33);
+ panel.add(theorymarksbutton);
+
+ practicalmarksbutton = new JButton("Practical Marks");
+ practicalmarksbutton.setBorder(new LineBorder(new Color(255, 255, 255)));
+ practicalmarksbutton.setForeground(new Color(255, 255, 255));
+ practicalmarksbutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ practicalmarksbutton.setBackground(new Color(32, 178, 170));
+ practicalmarksbutton.setBounds(893, 69, 148, 33);
+ practicalmarksbutton.setFocusable(false);
+ practicalmarksbutton.addActionListener(this);
+ practicalmarksbutton.setName("Deactive");
+ practicalmarksbutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ panel.add(practicalmarksbutton);
+
+ JLabel lblEnterStudentMarks = new JLabel("Enter Student Marks");
+ lblEnterStudentMarks.setForeground(new Color(255, 255, 255));
+ lblEnterStudentMarks.setBackground(new Color(255, 255, 255));
+ lblEnterStudentMarks.setFont(new Font("Segoe UI", Font.BOLD, 27));
+ lblEnterStudentMarks.setBounds(10, 65, 309, 33);
+ panel.add(lblEnterStudentMarks);
+
+ selectcourcepanel = new JPanel();
+ selectcourcepanel.setBounds(10, 159, 1073, 222);
+ add(selectcourcepanel);
+ selectcourcepanel.setBorder(new EmptyBorder(0, 0, 0, 0));
+ selectcourcepanel.setBackground(Color.WHITE);
+ selectcourcepanel.setLayout(null);
+
+ courcenamecombo = new JComboBox(new CourceData().getCourceName());
+ courcenamecombo.setFocusable(false);
+ courcenamecombo.setBackground(Color.WHITE);
+ courcenamecombo.addActionListener(this);
+ courcenamecombo.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ courcenamecombo.setBounds(236, 0, 825, 40);
+ selectcourcepanel.add(courcenamecombo);
+
+ semoryearcombo = new JComboBox();
+ semoryearcombo.setFocusable(false);
+ semoryearcombo.setBackground(Color.WHITE);
+ semoryearcombo.setBounds(236, 73, 825, 40);
+ semoryearcombo.addActionListener(this);
+ semoryearcombo.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ selectcourcepanel.add(semoryearcombo);
+
+ subjectnamecombo = new JComboBox();
+ subjectnamecombo.setFocusable(false);
+ subjectnamecombo.setBackground(Color.WHITE);
+ subjectnamecombo.setBounds(236, 143, 825, 40);
+ subjectnamecombo.addActionListener(this);
+ subjectnamecombo.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ selectcourcepanel.add(subjectnamecombo);
+
+ label1 = new JLabel("Select Cource :");
+ label1.setHorizontalAlignment(SwingConstants.RIGHT);
+ label1.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ label1.setBounds(10, -1, 200, 40);
+ selectcourcepanel.add(label1);
+
+ label2 = new JLabel("Select Sem/Year :");
+ label2.setHorizontalAlignment(SwingConstants.RIGHT);
+ label2.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ label2.setBounds(10, 72, 200, 40);
+ selectcourcepanel.add(label2);
+
+ label3 = new JLabel("Select Subject :");
+ label3.setHorizontalAlignment(SwingConstants.RIGHT);
+ label3.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ label3.setBounds(10, 142, 200, 40);
+ selectcourcepanel.add(label3);
+
+ Errorlabel = new JLabel("This is required question !");
+ Errorlabel.setVisible(false);
+ Errorlabel.setForeground(Color.RED);
+ Errorlabel.setFont(new Font("Arial", Font.PLAIN, 14));
+ Errorlabel.setBounds(233, 45, 225, 17);
+ selectcourcepanel.add(Errorlabel);
+
+
+
+ scrollPane = new JScrollPane();
+ scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
+ scrollPane.setBorder(new EmptyBorder(0, 0, 0, 0));
+ scrollPane.setBounds(10, 415, 1062, 40+(totalstudent*40));
+ for(Component c:scrollPane.getComponents())
+ {
+ c.setBackground(Color.white);
+ }
+ add(scrollPane);
+
+ table = new JTable();
+ table.setBorder(new LineBorder(new Color(192, 192, 192), 2));
+ table.setBackground(Color.white);
+ table.setRowHeight(40);
+ table.getTableHeader().setBackground(new Color(32, 178, 170));
+ table.getTableHeader().setForeground(Color.white);
+ table.getTableHeader().setFont(new Font("Arial",Font.BOLD,20));
+ table.setFont(new Font("Segoe UI",Font.PLAIN,20));
+ table.getTableHeader().setPreferredSize(new Dimension(50,40));
+ table.setDragEnabled(false);
+ table.setFocusable(false);
+ table.setSelectionModel(new ForcedListSelectionModel());
+ table.setSelectionBackground(new Color(240, 255, 255));
+ table.setSelectionForeground(Color.black);
+ table.setGridColor(Color.LIGHT_GRAY);
+
+
+ table.getTableHeader().setReorderingAllowed(false);
+
+// table.setEnabled(false);
+ scrollPane.setViewportView(table);
+
+ submitbutton = new JButton("Submit Marks");
+ submitbutton.setForeground(Color.WHITE);
+ submitbutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ submitbutton.setFocusable(false);
+ submitbutton.setBackground(new Color(32, 178, 170));
+ submitbutton.setBounds(923, 490, 149, 37);
+ submitbutton.setVisible(false);
+ submitbutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ submitbutton.setBorder(new EmptyBorder(0,0,0,0));
+ submitbutton.addActionListener(this);
+ add(submitbutton);
+
+ TableErrorlabel = new JLabel("Marks is greater than max marks !");
+ TableErrorlabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ TableErrorlabel.setForeground(new Color(255, 0, 0));
+ TableErrorlabel.setFont(new Font("candara", Font.PLAIN, 18));
+ TableErrorlabel.setBounds(20, 458, 1052, 21);
+ TableErrorlabel.setVisible(false);
+ add(TableErrorlabel);
+ scrollPane.setVisible(false);
+
+ nodatafoundlabel=new JLabel("");
+ nodatafoundlabel.setHorizontalAlignment(SwingConstants.CENTER);
+ try
+ {
+
+ Image image= ImageIO.read(new File("./assets/notfound2.png"));
+ nodatafoundlabel.setIcon(new ImageIcon(image.getScaledInstance(150, 150, Image.SCALE_SMOOTH)));
+
+ } catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ nodatafoundlabel.setText("No Students Found...!");
+ nodatafoundlabel.setVerticalTextPosition(JLabel.BOTTOM);
+ nodatafoundlabel.setBorder(null);
+ nodatafoundlabel.setBackground(new Color(245, 245, 245));
+ nodatafoundlabel.setFont(new Font("Tahoma", Font.PLAIN, 17));
+ nodatafoundlabel.setHorizontalTextPosition(JLabel.CENTER);
+ nodatafoundlabel.setIconTextGap(20);
+ nodatafoundlabel.setVisible(false);
+ nodatafoundlabel.setBounds(300, 380, 480, 321);
+ add(nodatafoundlabel);
+ }
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+
+ Errorlabel.setVisible(false);
+ TableErrorlabel.setVisible(false);
+ if(e.getSource()==courcenamecombo)
+ {
+ courcenamecombo.setFocusable(false);
+
+ subjectnamecombo.setModel(new DefaultComboBoxModel(new String[] {""}));
+ if(courcenamecombo.getSelectedIndex()==0)
+ {
+ semoryearcombo.setModel(new DefaultComboBoxModel(new String[] {""}));
+
+ }
+ else
+ {
+ String cource=(String) courcenamecombo.getSelectedItem();
+
+ semoryearcombo.setModel(new DefaultComboBoxModel(new CourceData().getSemorYear(cource)));
+ }
+
+ }
+ if(e.getSource()==semoryearcombo && semoryearcombo.getSelectedIndex()>0)
+ {
+ String cource=(String) courcenamecombo.getSelectedItem();
+
+ String[] totalsub=new SubjectData().getSubjectinCource(new CourceData().getCourcecode(cource), semoryearcombo.getSelectedIndex());
+ if(totalsub!=null)
+ {
+ subjectnamecombo.setModel(new DefaultComboBoxModel(totalsub));
+ }
+ else
+ {
+ subjectnamecombo.setModel(new DefaultComboBoxModel(new String[] {"No Subject Found"}));
+
+ }
+ }
+ else if(e.getSource()==semoryearcombo)
+ {
+ subjectnamecombo.setModel(new DefaultComboBoxModel(new String[] {""}));
+ }
+ if(e.getSource()==subjectnamecombo)
+ {
+ if(courcenamecombo.getSelectedIndex()==0)
+ {
+ showerror(courcenamecombo);
+ }
+ else if(semoryearcombo.getSelectedIndex()==0)
+ {
+ showerror(semoryearcombo);
+ }
+ else if(subjectnamecombo.getSelectedItem().equals("No Subject Found"))
+ {
+ Component tf=subjectnamecombo;
+ Errorlabel.setVisible(true);
+ Errorlabel.setText("No Subject Found !");
+ Errorlabel.setBounds(tf.getX(), tf.getY()+tf.getHeight()-5, 400,26);
+ }
+ else if(subjectnamecombo.getSelectedIndex()==0)
+ {
+ showerror(subjectnamecombo);
+ }
+
+ else
+ {
+
+ createtablemodel();
+
+ }
+ }
+ if(courcenamecombo.getSelectedIndex()==0 || semoryearcombo.getSelectedIndex()==0 || subjectnamecombo.getSelectedIndex()==0)
+ {
+ scrollPane.setVisible(false);
+ submitbutton.setVisible(false);
+ totalstudent=0;
+ this.setSize(1116, 544+(totalstudent*40));
+ }
+ if(e.getSource()==submitbutton)
+ {
+ if (table.isEditing())
+ {
+ table.getCellEditor().stopCellEditing();
+ }
+ if(theorymarksbutton.getName().equals("Active"))
+ {
+ this.addtheorymarks();
+ }
+ else
+ {
+ this.addpracticalmarks();
+ }
+
+ }
+ if(e.getSource()==theorymarksbutton)
+ {
+ ActiveButton(theorymarksbutton);
+ DeactiveButton(practicalmarksbutton);
+
+ if(courcenamecombo.getSelectedIndex()!=0 && semoryearcombo.getSelectedIndex()!=0 && subjectnamecombo.getSelectedIndex()!=0)
+ {
+ createtablemodel();
+ }
+ }
+ if(e.getSource()==practicalmarksbutton)
+ {
+ DeactiveButton(theorymarksbutton);
+ ActiveButton(practicalmarksbutton);
+ if(courcenamecombo.getSelectedIndex()!=0 && semoryearcombo.getSelectedIndex()!=0 && subjectnamecombo.getSelectedIndex()!=0)
+ {
+ createtablemodel();
+ }
+ }
+ if(totalstudent==0)
+ {
+ submitbutton.setVisible(false);
+ }
+
+
+ }
+ public void showerror(JComponent tf)
+ {
+ Errorlabel.setVisible(true);
+ Errorlabel.setText("This is required question !");
+ Errorlabel.setBounds(tf.getX(), tf.getY()+tf.getHeight()-5, 400,26);
+ }
+ public void createtablemodel()
+ {
+
+ nodatafoundlabel.setVisible(false);
+ if(theorymarksbutton.getName().equals("Active"))
+ {
+ table.setModel(createTheoryMarksModel());
+ }
+ else
+ {
+ table.setModel(createPracticalMarksModel());
+ }
+ totalstudent=table.getRowCount();
+
+ scrollPane.setBounds(10, scrollPane.getY(), 1062, 40+(totalstudent*40));
+ this.setSize(1116, 544+(totalstudent*40));
+ JTextField textField = new JTextField();
+ textField.setFont(new Font("Segoe UI",Font.PLAIN,20));
+ textField.setBorder(new LineBorder(Color.BLACK));
+ textField.setEnabled(true);
+ textField.setEditable(true);
+
+ DefaultCellEditor dce = new DefaultCellEditor( textField );
+ table.getColumnModel().getColumn(4).setCellEditor(dce);
+ table.getColumnModel().getColumn(0).setMaxWidth(200);
+ table.getColumnModel().getColumn(1).setMaxWidth(250);
+ table.getColumnModel().getColumn(2).setMaxWidth(300);
+ table.getColumnModel().getColumn(3).setMaxWidth(250);
+ table.getColumnModel().getColumn(4).setMaxWidth(250);
+ table.setSelectionBackground(new Color(240, 255, 255));
+ table.setSelectionForeground(Color.black);
+ table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
+ submitbutton.setLocation(submitbutton.getX(),scrollPane.getY()+scrollPane.getHeight()+40);
+ scrollPane.setVisible(true);
+ if(totalstudent==0)
+ {
+ noDataFound();
+ }
+ }
+ public void noDataFound()
+ {
+ scrollPane.setVisible(false);
+ submitbutton.setVisible(false);
+ nodatafoundlabel.setVisible(true);
+ nodatafoundlabel.setLocation(nodatafoundlabel.getX(), scrollPane.getY()-100);
+
+ }
+ public DefaultTableModel createTheoryMarksModel()
+ {
+
+ String courcecode=new CourceData().getCourcecode(courcenamecombo.getSelectedItem()+"");
+ int sem=semoryearcombo.getSelectedIndex();
+ String subjectname=subjectnamecombo.getSelectedItem()+"";
+ String[] columnname= {"Roll Number","Student Name","Subject Name","Max Theory Marks","Theory Marks"};
+ DefaultTableModel model = new DefaultTableModel(columnname,0) {
+
+ boolean[] canEdit = new boolean[]{
+ false, false, false, false, true
+ };
+
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return canEdit[columnIndex];
+ }
+ };
+ ArrayList listdata=new StudentData().getStudentTheoryMarksDetails(courcecode, sem, subjectname);
+
+ for(int i=0; i listdata=new StudentData().getStudentPracticalMarksDetails(courcecode, sem, subjectname);
+
+ for(int i=0; im.getMaxTheoryMarks())
+ {
+ TableError("Marks must be less than or equal to Maximum Marks !");
+ break;
+ }
+ else
+ {
+
+ result=new StudentData().addStudentTheoryMarks(m);
+ }
+
+ }
+ catch(NumberFormatException e)
+ {
+ TableError("Must be a Number !");
+ break;
+ }
+
+ }
+ if(result>0 && i==table.getRowCount())
+ {
+ TableErrorlabel.setForeground(new Color(34,139,34));
+ TableError("Theory Marks Succesfully submitted");
+ timer.restart();
+ }
+
+ if(i!=table.getRowCount())
+ {
+ TableErrorlabel.setForeground(Color.red);
+ timer.restart();
+
+ table.setSelectionBackground(Color.red);
+ table.setSelectionForeground(Color.white);
+ table.addRowSelectionInterval(i, i);
+
+ }
+ else
+ {
+ this.createtablemodel();
+ }
+ }
+ public void addpracticalmarks()
+ {
+ int result=0;
+ int i=0;
+ for(i=0; im.getMaxPracticalMarks())
+ {
+ TableError("Marks must be less than or equal to Maximum Marks !");
+ break;
+ }
+ else
+ {
+
+ result=new StudentData().addStudentPracticalMarks(m);
+ }
+
+ }
+ catch(NumberFormatException e)
+ {
+ TableError("Must be a Number !");
+ break;
+ }
+
+ }
+ if(result>0 && i==table.getRowCount())
+ {
+ TableErrorlabel.setForeground(new Color(34,139,34));
+ TableError("Practical Marks Succesfully submitted");
+ timer.restart();
+ }
+
+ if(i!=table.getRowCount())
+ {
+ TableErrorlabel.setForeground(Color.red);
+ timer.restart();
+
+ table.setSelectionBackground(Color.red);
+ table.setSelectionForeground(Color.white);
+ table.addRowSelectionInterval(i, i);
+
+ }
+ else
+ {
+ this.createtablemodel();
+ }
+ }
+
+ public void ActiveButton(JButton button)
+ {
+ button.setBorder(new LineBorder(new Color(255, 255, 255)));
+ button.setForeground(new Color(0, 139, 139));
+ button.setBackground(new Color(255, 255, 255));
+ button.setName("Active");
+ }
+ public void DeactiveButton(JButton button)
+ {
+
+ button.setBorder(new LineBorder(new Color(255, 255, 255)));
+ button.setForeground(new Color(255, 255, 255));
+ button.setBackground(new Color(32, 178, 170));
+ button.setName("Deactive");
+ }
+ public void TableError(String error)
+ {
+ TableErrorlabel.setVisible(true);
+ TableErrorlabel.setText(error);
+ TableErrorlabel.setLocation(10, scrollPane.getY()+scrollPane.getHeight()+10);
+ }
+}
+@SuppressWarnings("serial")
+class ForcedListSelectionModel extends DefaultListSelectionModel {
+
+ public ForcedListSelectionModel () {
+ setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ }
+
+ @Override
+ public void clearSelection() {
+ }
+
+ @Override
+ public void removeSelectionInterval(int index0, int index1) {
+ }
+
+}
\ No newline at end of file
diff --git a/src/collegeapplication/student/HeaderRendererForCheckBox.java b/src/collegeapplication/student/HeaderRendererForCheckBox.java
new file mode 100644
index 0000000..203d840
--- /dev/null
+++ b/src/collegeapplication/student/HeaderRendererForCheckBox.java
@@ -0,0 +1,93 @@
+package collegeapplication.student;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Graphics;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JCheckBox;
+import javax.swing.JLabel;
+import javax.swing.JTable;
+import javax.swing.SwingUtilities;
+import javax.swing.table.JTableHeader;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumnModel;
+import javax.swing.table.TableModel;
+
+
+public class HeaderRendererForCheckBox implements TableCellRenderer
+{
+
+ private final JCheckBox check = new JCheckBox();
+ public HeaderRendererForCheckBox(JTableHeader header,int column) {
+ check.setOpaque(false);
+ check.setFont(header.getFont());
+ header.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mousePressed(MouseEvent e) {
+
+ if(e.getButton()==MouseEvent.BUTTON1)
+ {
+ JTable table = ((JTableHeader) e.getSource()).getTable();
+ TableColumnModel columnModel = table.getColumnModel();
+ int viewColumn = columnModel.getColumnIndexAtX(e.getX());
+ int modelColumn = table.convertColumnIndexToModel(viewColumn);
+ if (modelColumn == column) {
+ check.setSelected(!check.isSelected());
+ TableModel m = table.getModel();
+ Boolean f = check.isSelected();
+ for (int i = 0; i < m.getRowCount(); i++) {
+ m.setValueAt(f, i, modelColumn);
+ }
+ ((JTableHeader) e.getSource()).repaint();
+ }
+ }
+ }
+ });
+}
+
+@Override
+public Component getTableCellRendererComponent(
+ JTable tbl, Object val, boolean isS, boolean hasF, int row, int col) {
+ TableCellRenderer r = tbl.getTableHeader().getDefaultRenderer();
+
+ JLabel l = (JLabel) r.getTableCellRendererComponent(tbl, val, isS, hasF, row, col);
+ l.setIcon(new CheckBoxIcon(check));
+ l.setFocusable(true);
+
+ // Set disabled icon for checkbox
+ return l;
+}
+
+private static class CheckBoxIcon implements Icon {
+
+ private final JCheckBox check;
+
+
+ public CheckBoxIcon(JCheckBox check) {
+ this.check = check;
+ check.setSelectedIcon(new ImageIcon("./assets/selectedcheckboxforheader.png"));
+ check.setIcon(new ImageIcon("./assets/unselectedcheckboxforheader.png"));
+ }
+
+ @Override
+ public int getIconWidth() {
+ return check.getPreferredSize().width;
+ }
+
+ @Override
+ public int getIconHeight() {
+ return check.getPreferredSize().height;
+ }
+
+ @Override
+ public void paintIcon(Component c, Graphics g, int x, int y) {
+ SwingUtilities.paintComponent(
+ g, check, (Container) c, x, y, getIconWidth(), getIconHeight());
+ }
+}
+}
diff --git a/src/collegeapplication/student/MarkAttandancePanel.java b/src/collegeapplication/student/MarkAttandancePanel.java
new file mode 100644
index 0000000..b980981
--- /dev/null
+++ b/src/collegeapplication/student/MarkAttandancePanel.java
@@ -0,0 +1,515 @@
+package collegeapplication.student;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Image;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+
+import javax.imageio.ImageIO;
+import javax.swing.DefaultCellEditor;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JSpinner;
+import javax.swing.JTable;
+import javax.swing.SpinnerDateModel;
+import javax.swing.SwingConstants;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.LineBorder;
+import javax.swing.border.MatteBorder;
+import javax.swing.table.DefaultTableModel;
+
+import collegeapplication.admin.AdminMain;
+import collegeapplication.common.Notification;
+import collegeapplication.common.NotificationData;
+import collegeapplication.common.TimeUtil;
+import collegeapplication.cource.CourceData;
+import collegeapplication.faculty.FacultyMain;
+import collegeapplication.subject.SubjectData;
+
+/*
+ * Title : MarkAttandancePanel.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : For marking student attandance
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+@SuppressWarnings("serial")
+public class MarkAttandancePanel extends JPanel implements ActionListener {
+
+ private JTable table;
+ private JComboBox semoryearcombo;
+ private JLabel lblError;
+ private JScrollPane scrollPane;
+ private JComboBox subjectnamecombo;
+ private JSpinner datespinner;
+ private JComboBox courcenamecombo;
+ int totalstudent=0;
+ private JButton submitbutton;
+ private JButton fetchstudentbutton;
+ private JLabel label1;
+ private JLabel label2;
+ private JLabel label3;
+ private JLabel headerlabel;
+ private JLabel label;
+ private JLabel nodatafoundlabel;
+
+ /**
+ * Create the panel.
+ */
+ @Override
+ public Dimension getPreferredSize()
+ {
+ return new Dimension(1116,scrollPane.getY()+80+totalstudent*40+60);
+
+ }
+ public MarkAttandancePanel(AdminMain am)
+ {
+ this();
+ }
+ public MarkAttandancePanel(FacultyMain fm)
+ {
+ this();
+
+ courcenamecombo.setSelectedItem(new CourceData().getcourcename(fm.f.getCourceCode()));
+ semoryearcombo.setModel(new DefaultComboBoxModel(new CourceData().getSemorYear(courcenamecombo.getSelectedItem()+"")));
+ String[] totalsub=new SubjectData().getSubjectinCource(fm.f.getCourceCode(), fm.f.getSemorYear());
+ subjectnamecombo.setModel(new DefaultComboBoxModel(totalsub));
+ semoryearcombo.setSelectedIndex(fm.f.getSemorYear());
+ subjectnamecombo.setSelectedItem(fm.f.getSubject());
+ courcenamecombo.setVisible(false);
+ semoryearcombo.setVisible(false);
+ subjectnamecombo.setVisible(false);
+ scrollPane.setLocation(scrollPane.getX(),semoryearcombo.getY());
+ label1.setVisible(false);
+ label2.setVisible(false);
+ label3.setVisible(false);
+ headerlabel.setHorizontalAlignment(JLabel.LEFT);
+ headerlabel.setBounds(10, 0, 1078, 183);
+ label.setLocation(label.getX(), headerlabel.getY()+headerlabel.getHeight()+20);
+ fetchstudentbutton.setLocation(fetchstudentbutton.getX(), label.getY()+label.getHeight()+20);
+
+ datespinner.setLocation(datespinner.getX(), label.getY());
+ scrollPane.setBounds(scrollPane.getX(),fetchstudentbutton.getY()+fetchstudentbutton.getHeight()+20 , scrollPane.getWidth(), this.getHeight()-headerlabel.getHeight()-20);
+
+ }
+
+
+ private MarkAttandancePanel() {
+
+ setBackground(Color.WHITE);
+ this.setSize(1116, 705);
+ setLayout(null);
+
+ headerlabel = new JLabel(" Mark Attandance ");
+ headerlabel.setBackground(new Color(32, 178, 170));
+ headerlabel.setHorizontalAlignment(SwingConstants.CENTER);
+ headerlabel.setForeground(new Color(255, 255, 255));
+ headerlabel.setFont(new Font("Segoe UI", Font.BOLD, 30));
+ headerlabel.setBounds(10, 0, 1078, 66);
+ headerlabel.setOpaque(true);
+ add(headerlabel);
+
+ label = new JLabel("Select Date :");
+ label.setHorizontalAlignment(SwingConstants.RIGHT);
+ label.setForeground(Color.DARK_GRAY);
+ label.setFont(new Font("Segoe UI", Font.PLAIN, 19));
+ label.setBounds(39, 90, 153, 40);
+ add(label);
+
+
+ label1 = new JLabel("Cource Name :");
+ label1.setHorizontalAlignment(SwingConstants.RIGHT);
+ label1.setForeground(Color.DARK_GRAY);
+ label1.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ label1.setBounds(29, 158, 163, 37);
+ add(label1);
+
+ label2 = new JLabel("Semester or Years :");
+ label2.setHorizontalAlignment(SwingConstants.RIGHT);
+ label2.setForeground(Color.DARK_GRAY);
+ label2.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ label2.setBounds(23, 222, 169, 40);
+ add(label2);
+
+ label3 = new JLabel("Select Subject :");
+ label3.setHorizontalAlignment(SwingConstants.RIGHT);
+ label3.setForeground(Color.DARK_GRAY);
+ label3.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ label3.setBounds(29, 293, 163, 32);
+ add(label3);
+
+
+ lblError=new JLabel("This is required question !");
+ lblError.setBorder(new MatteBorder(0, 0, 0, 0, (Color) new Color(255, 0, 0)));
+ lblError.setForeground(new Color(255, 0, 0));
+ lblError.setFont(new Font("Candara", Font.PLAIN, 17));
+ lblError.setVisible(false);
+ lblError.setBounds(211,134,355,21);
+ add(lblError);
+
+
+
+
+
+ scrollPane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_NEVER,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+
+ scrollPane.setBorder(new MatteBorder(0, 0, 2, 1, (Color) new Color(192, 192, 192)));
+ scrollPane.setVisible(false);
+ scrollPane.setBounds(29, 413, 1044, 66);
+ for(Component c:scrollPane.getComponents())
+ {
+ c.setBackground(Color.white);
+ }
+ add(scrollPane);
+
+ table = new JTable();
+ table.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ table.setForeground(new Color(0, 0, 0));
+ table.setRowHeight(40);
+ table.getTableHeader().setBackground(new Color(32,178,170));
+ table.getTableHeader().setForeground(Color.white);
+ table.getTableHeader().setFont(new Font("Arial",Font.BOLD,20));
+ table.setFont(new Font("Segoe UI",Font.PLAIN,20));
+ table.getTableHeader().setPreferredSize(new Dimension(50,40));
+ table.setDragEnabled(false);
+ table.setFocusable(false);
+ table.setGridColor(Color.LIGHT_GRAY);
+ table.getTableHeader().setReorderingAllowed(false);
+ scrollPane.setViewportView(table);
+
+ submitbutton = new JButton("Submit");
+ submitbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ submitbutton.setForeground(Color.WHITE);
+ submitbutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ submitbutton.setFocusable(false);
+ submitbutton.setBackground(new Color(32, 178, 170));
+ submitbutton.setVisible(false);
+ submitbutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ submitbutton.setBounds(924, 504, 149, 37);
+ submitbutton.addActionListener(this);
+ add(submitbutton);
+
+
+
+ courcenamecombo = new JComboBox(new CourceData().getCourceName());
+
+ courcenamecombo.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ courcenamecombo.addActionListener(this);
+ courcenamecombo.setFocusable(false);
+ courcenamecombo.setBackground(new Color(255, 255, 255));
+ courcenamecombo.setBounds(204, 156, 867, 40);
+ add(courcenamecombo);
+
+ semoryearcombo = new JComboBox();
+ semoryearcombo.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ semoryearcombo.setBackground(Color.WHITE);
+ semoryearcombo.setBounds(204, 222, 867, 40);
+ semoryearcombo.addActionListener(this);
+ semoryearcombo.setFocusable(false);
+
+ add(semoryearcombo);
+ subjectnamecombo = new JComboBox();
+ subjectnamecombo.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ subjectnamecombo.setFocusable(false);
+ subjectnamecombo.addActionListener(this);
+ subjectnamecombo.setBackground(Color.WHITE);
+ subjectnamecombo.setBounds(205, 289, 867, 40);
+ add(subjectnamecombo);
+
+ datespinner = new JSpinner();
+ datespinner.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ datespinner.setBounds(204, 90, 867, 40);
+ SimpleDateFormat dateformat=new SimpleDateFormat("dd-MM-yyyy");
+ datespinner.setModel(new SpinnerDateModel());
+ datespinner.setEditor(new JSpinner.DateEditor(datespinner,dateformat.toPattern()));
+// datespinner.setBorder(new LineBorder(new Color(32, 178, 170), 2, true));
+ add(datespinner);
+
+ fetchstudentbutton = new JButton("Fetch Students");
+ fetchstudentbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ fetchstudentbutton.setFocusPainted(false);
+ fetchstudentbutton.setBackground(new Color(32, 178, 170));
+ fetchstudentbutton.setForeground(Color.WHITE);
+ fetchstudentbutton.setFocusable(true);
+ fetchstudentbutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ fetchstudentbutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ fetchstudentbutton.setBounds(920, 352, 151, 37);
+ fetchstudentbutton.addActionListener(this);
+ add(fetchstudentbutton);
+
+ nodatafoundlabel=new JLabel("");
+ nodatafoundlabel.setHorizontalAlignment(SwingConstants.CENTER);
+ try
+ {
+
+ Image image= ImageIO.read(new File("./assets/notfound2.png"));
+ nodatafoundlabel.setIcon(new ImageIcon(image.getScaledInstance(150, 150, Image.SCALE_SMOOTH)));
+
+ } catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ nodatafoundlabel.setText("No Students Found...!");
+ nodatafoundlabel.setVerticalTextPosition(JLabel.BOTTOM);
+ nodatafoundlabel.setBorder(null);
+ nodatafoundlabel.setBackground(new Color(245, 245, 245));
+ nodatafoundlabel.setFont(new Font("Tahoma", Font.PLAIN, 17));
+ nodatafoundlabel.setHorizontalTextPosition(JLabel.CENTER);
+ nodatafoundlabel.setIconTextGap(20);
+ nodatafoundlabel.setVisible(false);
+ nodatafoundlabel.setBounds(300, 380, 480, 321);
+ add(nodatafoundlabel);
+
+ }
+
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ lblError.setVisible(false);
+
+ if(e.getSource()==courcenamecombo)
+ {
+ courcenamecombo.setFocusable(false);
+
+ subjectnamecombo.setModel(new DefaultComboBoxModel(new String[] {""}));
+ if(courcenamecombo.getSelectedIndex()==0)
+ {
+ semoryearcombo.setModel(new DefaultComboBoxModel(new String[] {""}));
+
+ }
+ else
+ {
+ String cource=(String) courcenamecombo.getSelectedItem();
+
+ semoryearcombo.setModel(new DefaultComboBoxModel(new CourceData().getSemorYear(cource)));
+ }
+
+ }
+ if(e.getSource()==semoryearcombo && semoryearcombo.getSelectedIndex()>0)
+ {
+ String cource=(String) courcenamecombo.getSelectedItem();
+
+ String[] totalsub=new SubjectData().getSubjectinCource(new CourceData().getCourcecode(cource), semoryearcombo.getSelectedIndex());
+ if(totalsub!=null)
+ {
+ subjectnamecombo.setModel(new DefaultComboBoxModel(totalsub));
+ }
+ else
+ {
+ subjectnamecombo.setModel(new DefaultComboBoxModel(new String[] {"No Subject Found"}));
+
+ }
+ }
+ else if(e.getSource()==semoryearcombo)
+ {
+ subjectnamecombo.setModel(new DefaultComboBoxModel(new String[] {""}));
+ }
+ if(e.getSource()==fetchstudentbutton)
+ {
+ if(courcenamecombo.getSelectedIndex()==0)
+ {
+ showerror(courcenamecombo);
+ }
+ else if(semoryearcombo.getSelectedIndex()==0)
+ {
+ showerror(semoryearcombo);
+ }
+ else if(subjectnamecombo.getSelectedItem().equals("No Subject Found"))
+ {
+ Component tf=subjectnamecombo;
+ lblError.setVisible(true);
+ lblError.setText("No Subject Found !");
+ lblError.setBounds(tf.getX(), tf.getY()+tf.getHeight()-5, 400,26);
+ }
+ else if(subjectnamecombo.getSelectedIndex()==0)
+ {
+ showerror(subjectnamecombo);
+ }
+
+ else
+ {
+
+ createtablemodel();
+
+
+ }
+ }
+ if(submitbutton==e.getSource())
+ {
+ this.submitAttandance();
+
+ }
+ // TODO Auto-generated method stub
+
+ }
+ public void noDataFound()
+ {
+ scrollPane.setVisible(false);
+ submitbutton.setVisible(false);
+ nodatafoundlabel.setVisible(true);
+ nodatafoundlabel.setLocation(nodatafoundlabel.getX(), scrollPane.getY()-80);
+
+ }
+ public void showerror(JComponent tf)
+ {
+ lblError.setVisible(true);
+ lblError.setText("This is required question !");
+ lblError.setBounds(tf.getX(), tf.getY()+tf.getHeight()-5, 400,26);
+ }
+ public void setIcons(JTable table, int column, Icon icon, Icon selectedIcon) {
+ JCheckBox cellRenderer = (JCheckBox) table.getCellRenderer(0, column);
+ cellRenderer.setSelectedIcon(selectedIcon);
+ cellRenderer.setIcon(icon);
+
+ DefaultCellEditor cellEditor = (DefaultCellEditor) table.getCellEditor(0, column);
+ JCheckBox editorComponent = (JCheckBox) cellEditor.getComponent();
+ editorComponent.setSelectedIcon(selectedIcon);
+ editorComponent.setIcon(icon);
+ }
+ public void createtablemodel()
+ {
+ nodatafoundlabel.setVisible(false);
+ Attandance a=new Attandance();
+ a.setCourceCode(new CourceData().getCourcecode(courcenamecombo.getSelectedItem()+""));
+ Date date=(Date) datespinner.getValue();
+ a.setAttandanceDate(new SimpleDateFormat("dd-MM-yyyy").format(date));
+ a.setSemorYear(semoryearcombo.getSelectedIndex());
+ a.setSubjectName(subjectnamecombo.getSelectedItem()+"");
+ a.setSubjectCode(new SubjectData().getSubjectCode(a.getCourceCode(), a.getSemorYear(),a.getSubjectName()));
+ if(new StudentData().isSubmitted(a.getSubjectCode(), a.getAttandanceDate()))
+ {
+ scrollPane.setVisible(false);
+ submitbutton.setVisible(false);
+ JOptionPane.showMessageDialog(null, "Attandance Already Submitted","Error",JOptionPane.INFORMATION_MESSAGE);
+ }
+ else
+ {
+ table.setModel(createModel(a));
+ scrollPane.setSize(scrollPane.getWidth(), 40+(totalstudent*40));
+ this.setSize(1116, scrollPane.getY()+80+totalstudent*40+60);
+
+ submitbutton.setLocation(submitbutton.getX(),scrollPane.getY()+scrollPane.getHeight()+20);
+ table.getColumnModel().getColumn(0).setMaxWidth(200);
+ table.getColumnModel().getColumn(1).setMaxWidth(250);
+ table.getColumnModel().getColumn(2).setMaxWidth(250);
+ table.getColumnModel().getColumn(3).setMaxWidth(175);
+ table.getColumnModel().getColumn(4).setMaxWidth(150);
+ table.getColumnModel().getColumn(5).setMaxWidth(250);
+ table.getColumnModel().getColumn(6).setMaxWidth(80);
+
+ table.getColumnModel().getColumn(6).setHeaderRenderer(
+ new HeaderRendererForCheckBox(table.getTableHeader(),6));
+
+ this.setIcons(table, 6, new ImageIcon("./assets/unselectedcheckboxicon.png"), new ImageIcon("./assets/selectedcheckboxicon.png"));
+ table.setSelectionBackground(new Color(255, 255, 255));
+ table.setSelectionForeground(Color.black);
+ table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
+ scrollPane.setVisible(true);
+ if(totalstudent==0)
+ {
+ noDataFound();
+ }
+ }
+ }
+ public DefaultTableModel createModel(Attandance a)
+ {
+ String Column[]= {"Roll Number","Student Name","Subject Code","Cource","Sem/Year","Attandance Date",""};
+ DefaultTableModel model=new DefaultTableModel(Column,0)
+ {
+ boolean canEdit[]= {false,false,false,false,false,false,true};
+ public Class> getColumnClass(int column)
+ {
+ switch(column)
+ {
+ case 0: return String.class;
+ case 1: return String.class;
+ case 2: return String.class;
+ case 3: return String.class;
+ case 4: return String.class;
+ case 5: return String.class;
+ case 6: return Boolean.class;
+ default : return String.class;
+ }
+ }
+ @Override
+ public boolean isCellEditable(int row,int column)
+ {
+ return canEdit[column];
+ }
+ };
+
+ ArrayList list=new StudentData().getStudentsForAttandance(a);
+ for(int i=0; i list=new StudentData().getMarkssheetOfStudent(s.getCourceCode(), s.getSemorYear(), s.getRollNumber());
+ totalsubject=list.size();
+ String ColumnName[]= {"Subject Code","Subject Name","Theory Marks","Practical Marks","Total Max. Marks","Total"};
+ DefaultTableModel model=new DefaultTableModel(ColumnName,0);
+ int totaltheorymarks=0;
+ int maxtotaltheorymarks=0;
+ int totalpracticalmarks=0;
+ int maxtotalpracticalmarks=0;
+ for(int i=0; i0)
+ {
+ Object result[]= {"","Total Marks",totaltheorymarks,totalpracticalmarks,maxtotaltheorymarks+maxtotalpracticalmarks,(totaltheorymarks+totalpracticalmarks)};
+ model.addRow(result);
+ }
+ else
+ {
+ Object result[]= {"-","No Subject Found","-","-","-","-"};
+ model.addRow(result);
+ }
+
+ totalsubject++;
+ table.setModel(model);
+
+ table.getColumnModel().getColumn(0).setMaxWidth(200);
+ table.getColumnModel().getColumn(1).setMaxWidth(250);
+ table.getColumnModel().getColumn(2).setMaxWidth(175);
+ table.getColumnModel().getColumn(3).setMaxWidth(175);
+ table.getColumnModel().getColumn(4).setMaxWidth(175);
+ table.getColumnModel().getColumn(5).setMaxWidth(175);
+ table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
+ table.setFocusable(false);
+
+
+ tableviewpanel.setSize(1075, rowsize+(totalsubject*rowsize));
+ table.setEnabled(false);
+ this.setSize(1096,460+(totalsubject*rowsize));
+ System.out.println("Marksheet :"+new CourceData().isDeclared(s.getCourceCode(), s.getSemorYear()));
+ if(!new CourceData().isDeclared(s.getCourceCode(), s.getSemorYear()))
+ {
+ notDeclared();
+ }
+ }
+ public void disablebutton()
+ {
+ downloadbutton.setVisible(false);
+ backbutton.setVisible(false);
+ }
+ public void enablebutton()
+ {
+ downloadbutton.setVisible(true);
+ backbutton.setVisible(true);
+ }
+
+private class CellRenderer extends DefaultTableCellRenderer {
+
+private static final long serialVersionUID = 1L;
+
+@Override
+public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row,
+ int column)
+{
+ super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+ if (row==(totalsubject-1))
+ {
+
+ this.setFont(this.getFont().deriveFont(Font.BOLD));
+ if(row==0)
+ {
+ this.setHorizontalAlignment(JLabel.CENTER);
+ }
+
+ }
+ return this;
+}
+}
+}
+
+
diff --git a/src/collegeapplication/student/MarkSheetReportPanel.java b/src/collegeapplication/student/MarkSheetReportPanel.java
new file mode 100644
index 0000000..d3ad0ea
--- /dev/null
+++ b/src/collegeapplication/student/MarkSheetReportPanel.java
@@ -0,0 +1,846 @@
+package collegeapplication.student;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Image;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+
+import javax.imageio.ImageIO;
+import javax.swing.DefaultCellEditor;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.SwingConstants;
+import javax.swing.border.LineBorder;
+import javax.swing.table.DefaultTableCellRenderer;
+import javax.swing.table.DefaultTableModel;
+
+import collegeapplication.admin.AdminMain;
+import collegeapplication.cource.Cource;
+import collegeapplication.cource.CourceData;
+import collegeapplication.faculty.FacultyMain;
+import collegeapplication.subject.SubjectData;
+
+/*
+ * Title : MarkSheetReportPanel.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : To display all students marks in class/subject/student wice
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+
+@SuppressWarnings("serial")
+public class MarkSheetReportPanel extends JPanel implements ActionListener {
+
+ private JComboBox courcenamecombo;
+ private JComboBox semoryearcombo;
+ private JComboBox subjectorrollcombo;
+ private JTable table;
+ private JScrollPane scrollPane;
+ private int totalstudent=0;
+ private JLabel Errorlabel;
+ private JButton studentwicebutton;
+ private JButton classwicebutton;
+ private JButton subjectwicebutton;
+ private JButton fetchdetailsbutton;
+ private JLabel label3;
+ private JLabel label1;
+ private JLabel label2;
+ private JButton declareresultbutton;
+ private JButton submitbutton;
+ private JLabel nodatafoundlabel;
+
+ /**
+ * Create the panel.
+ */
+ @Override
+ public Dimension getPreferredSize()
+ {
+ return new Dimension(1096,this.getHeight());
+
+ }
+
+ private MarkSheetReportPanel() {
+
+ setBorder(null);
+ setBackground(new Color(255, 255, 255));
+ this.setSize(1116, 544);
+ setLayout(null);
+ JPanel panel = new JPanel();
+ panel.setBackground(new Color(32, 178, 170));
+ panel.setBounds(10, 0, 1077, 183);
+ add(panel);
+ panel.setLayout(null);
+ JLabel headingLabel = new JLabel("Marksheet Report");
+ headingLabel.setIcon(null);
+ headingLabel.setBounds(10, 65, 272, 44);
+ panel.add(headingLabel);
+ headingLabel.setBackground(new Color(32, 178, 170))
+ ;
+ headingLabel.setHorizontalAlignment(SwingConstants.LEFT);
+ headingLabel.setForeground(Color.WHITE);
+ headingLabel.setFont(new Font("Segoe UI", Font.BOLD, 28));
+ headingLabel.setOpaque(true);
+
+ declareresultbutton = new JButton("Declare Result");
+ declareresultbutton.setForeground(new Color(0, 139, 139));
+ declareresultbutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ declareresultbutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ declareresultbutton.setBackground(new Color(255, 255, 255));
+ declareresultbutton.setBounds(417, 139, 146, 33);
+ declareresultbutton.setFocusable(false);
+ this.disableButton(declareresultbutton);
+ declareresultbutton.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ // TODO Auto-generated method stub
+ activeButton(declareresultbutton);
+ disableButton(classwicebutton);
+ disableButton(subjectwicebutton);
+ disableButton(studentwicebutton);
+ semoryearcombo.setVisible(false);
+ subjectorrollcombo.setVisible(false);
+ label2.setVisible(false);
+ label3.setVisible(false);
+ scrollPane.setVisible(false);
+ fetchdetailsbutton.setLocation(fetchdetailsbutton.getX(), semoryearcombo.getY());
+ scrollPane.setLocation(scrollPane.getX(), subjectorrollcombo.getY());
+ courcenamecombo.setSelectedIndex(0);
+
+ }
+
+ });
+ panel.add(declareresultbutton);
+
+ subjectwicebutton = new JButton("Subject Wice");
+ subjectwicebutton.setForeground(new Color(0, 139, 139));
+ subjectwicebutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ subjectwicebutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ subjectwicebutton.setBackground(new Color(255, 255, 255));
+ subjectwicebutton.setBounds(577, 139, 146, 33);
+
+ panel.add(subjectwicebutton);
+
+ studentwicebutton = new JButton("Student Wice");
+ studentwicebutton.setForeground(new Color(0, 139, 139));
+ studentwicebutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ studentwicebutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ studentwicebutton.setBackground(Color.WHITE);
+ studentwicebutton.setBounds(742, 139, 146, 33);
+
+ panel.add(studentwicebutton);
+
+ classwicebutton = new JButton("Class Wice");
+ classwicebutton.setForeground(new Color(0, 139, 139));
+ classwicebutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ classwicebutton.setBackground(Color.WHITE);
+ classwicebutton.setBounds(907, 139, 146, 33);
+ classwicebutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+
+ panel.add(classwicebutton);
+
+ label1 = new JLabel("Cource Name :");
+ label1.setHorizontalAlignment(SwingConstants.RIGHT);
+ label1.setForeground(Color.DARK_GRAY);
+ label1.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ label1.setBounds(29, 213, 163, 37);
+ add(label1);
+
+ label2 = new JLabel("Semester or Years :");
+ label2.setHorizontalAlignment(SwingConstants.RIGHT);
+ label2.setForeground(Color.DARK_GRAY);
+ label2.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ label2.setBounds(23, 270, 169, 40);
+ add(label2);
+
+ label3 = new JLabel("Select Subject :");
+ label3.setHorizontalAlignment(SwingConstants.RIGHT);
+ label3.setForeground(Color.DARK_GRAY);
+ label3.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ label3.setBounds(29, 339, 163, 32);
+ add(label3);
+
+ courcenamecombo = new JComboBox(new CourceData().getCourceName());
+ courcenamecombo.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ courcenamecombo.addActionListener(this);
+ courcenamecombo.setFocusable(false);
+ courcenamecombo.setBackground(new Color(255, 255, 255));
+ courcenamecombo.setBounds(204, 211, 872, 40);
+ add(courcenamecombo);
+
+ semoryearcombo = new JComboBox();
+ semoryearcombo.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ semoryearcombo.setBackground(Color.WHITE);
+ semoryearcombo.setBounds(204, 270, 872, 40);
+ semoryearcombo.addActionListener(this);
+ semoryearcombo.setFocusable(false);
+
+ add(semoryearcombo);
+ subjectorrollcombo = new JComboBox();
+ subjectorrollcombo.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ subjectorrollcombo.setFocusable(false);
+ subjectorrollcombo.addActionListener(this);
+ subjectorrollcombo.setBackground(Color.WHITE);
+ subjectorrollcombo.setBounds(204, 335, 872, 40);
+ add(subjectorrollcombo);
+
+ scrollPane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_NEVER,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ scrollPane.setBounds(21, 460, 1055, 84);
+ scrollPane.getVerticalScrollBar().setUnitIncrement(80);
+ for(Component c:scrollPane.getComponents())
+ {
+ c.setBackground(Color.white);
+ }
+ add(scrollPane);
+ scrollPane.setVisible(false);
+ table = new JTable();
+ table.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ table.setForeground(new Color(0, 0, 0));
+ table.setRowHeight(40);
+ table.getTableHeader().setBackground(new Color(32,178,170));
+ table.getTableHeader().setForeground(Color.white);
+ table.getTableHeader().setFont(new Font("Arial",Font.BOLD,20));
+ table.setFont(new Font("Segoe UI",Font.PLAIN,20));
+ table.getTableHeader().setPreferredSize(new Dimension(50,40));
+ table.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ table.setDragEnabled(false);
+ table.setFocusable(false);
+ table.setGridColor(Color.LIGHT_GRAY);
+ table.getTableHeader().setReorderingAllowed(false);
+
+ scrollPane.setViewportView(table);
+ Errorlabel = new JLabel("This is required question !");
+ Errorlabel.setVisible(false);
+ Errorlabel.setForeground(Color.RED);
+ Errorlabel.setFont(new Font("Arial", Font.PLAIN, 14));
+ Errorlabel.setBounds(233, 45, 225, 17);
+ add(Errorlabel);
+ activeButton(subjectwicebutton);
+ disableButton(studentwicebutton);
+ disableButton(classwicebutton);
+ disableButton(declareresultbutton);
+
+ fetchdetailsbutton = new JButton("Fetch Details");
+ fetchdetailsbutton.setForeground(Color.WHITE);
+ fetchdetailsbutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ fetchdetailsbutton.setFocusPainted(false);
+ fetchdetailsbutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ fetchdetailsbutton.addActionListener(this);
+ fetchdetailsbutton.setBorder(new LineBorder(new Color(255, 255, 255)));
+ fetchdetailsbutton.setBackground(new Color(32, 178, 170));
+ fetchdetailsbutton.setBounds(926, 399, 151, 37);
+ add(fetchdetailsbutton);
+
+ submitbutton = new JButton("Declare Result");
+ submitbutton.setForeground(Color.WHITE);
+ submitbutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ submitbutton.setVisible(false);
+ submitbutton.setFocusPainted(false);
+ submitbutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ submitbutton.addActionListener(new DeclareResult());
+ submitbutton.setBorder(new LineBorder(new Color(255, 255, 255)));
+ submitbutton.setBackground(new Color(32, 178, 170));
+ submitbutton.setBounds(926, 399, 151, 37);
+ add(submitbutton);
+
+ nodatafoundlabel=new JLabel("");
+ nodatafoundlabel.setHorizontalAlignment(SwingConstants.CENTER);
+ try
+ {
+
+ Image image= ImageIO.read(new File("./assets/notfound2.png"));
+ nodatafoundlabel.setIcon(new ImageIcon(image.getScaledInstance(150, 150, Image.SCALE_SMOOTH)));
+
+ } catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ nodatafoundlabel.setText("No Data Found...!");
+ nodatafoundlabel.setVerticalTextPosition(JLabel.BOTTOM);
+ nodatafoundlabel.setBorder(null);
+ nodatafoundlabel.setBackground(new Color(245, 245, 245));
+ nodatafoundlabel.setFont(new Font("Tahoma", Font.PLAIN, 17));
+ nodatafoundlabel.setHorizontalTextPosition(JLabel.CENTER);
+ nodatafoundlabel.setIconTextGap(20);
+ nodatafoundlabel.setVisible(false);
+ nodatafoundlabel.setBounds(300, 380, 480, 321);
+ add(nodatafoundlabel);
+
+ }
+
+
+ public MarkSheetReportPanel(AdminMain am)
+ {
+ this();
+ table.addMouseListener(new MouseAdapterForTable(am));
+ subjectwicebutton.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ activeButton(subjectwicebutton);
+ disableButton(studentwicebutton);
+ disableButton(classwicebutton);
+ disableButton(declareresultbutton);
+
+ label2.setVisible(true);
+ courcenamecombo.setVisible(true);
+ semoryearcombo.setVisible(true);
+ subjectorrollcombo.setVisible(true);
+ label3.setVisible(true);
+ fetchdetailsbutton.setLocation(fetchdetailsbutton.getX(),subjectorrollcombo.getY()+65);
+ scrollPane.setLocation(scrollPane.getX(), fetchdetailsbutton.getY()+60);
+ label3.setText("Select Subject :");
+ subjectorrollcombo.setModel(new DefaultComboBoxModel(new String[] {""}));
+ courcenamecombo.setSelectedIndex(0);
+ semoryearcombo.setModel(new DefaultComboBoxModel(new String[]{""}));
+ scrollPane.setVisible(false);
+ }
+
+ }
+ );
+ studentwicebutton.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ // TODO Auto-generated method stub
+ activeButton(studentwicebutton);
+ disableButton(subjectwicebutton);
+ disableButton(classwicebutton);
+ disableButton(declareresultbutton);
+ label2.setVisible(true);
+ courcenamecombo.setVisible(true);
+ semoryearcombo.setVisible(true);
+ label3.setVisible(true);
+ subjectorrollcombo.setVisible(true);
+ label3.setText("Select Roll Number :");
+ fetchdetailsbutton.setLocation(fetchdetailsbutton.getX(),subjectorrollcombo.getY()+65);
+ scrollPane.setLocation(scrollPane.getX(), fetchdetailsbutton.getY()+60);
+ subjectorrollcombo.setModel(new DefaultComboBoxModel(new String[] {""}));
+ courcenamecombo.setSelectedIndex(0);
+ semoryearcombo.setModel(new DefaultComboBoxModel(new String[]{""}));
+ scrollPane.setVisible(false);
+
+ }
+
+ }
+ );
+ classwicebutton.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ // TODO Auto-generated method stub
+ subjectwicebutton.setName("Active");
+ courcenamecombo.setVisible(true);
+ semoryearcombo.setVisible(true);
+ activeButton(classwicebutton);
+ disableButton(studentwicebutton);
+ disableButton(subjectwicebutton);
+ disableButton(declareresultbutton);
+ label2.setVisible(true);
+ subjectorrollcombo.setVisible(false);
+ label3.setVisible(false);
+ fetchdetailsbutton.setLocation(fetchdetailsbutton.getX(),subjectorrollcombo.getY());
+ scrollPane.setLocation(scrollPane.getX(), fetchdetailsbutton.getY()+60);
+ courcenamecombo.setSelectedIndex(0);
+ semoryearcombo.setModel(new DefaultComboBoxModel(new String[]{""}));
+ scrollPane.setVisible(false);
+ }
+
+ }
+ );
+
+ }
+ public MarkSheetReportPanel(FacultyMain fm)
+ {
+
+ this();
+ declareresultbutton.setVisible(false);
+ courcenamecombo.setSelectedItem(new CourceData().getcourcename(fm.f.getCourceCode()));
+ semoryearcombo.setModel(new DefaultComboBoxModel(new CourceData().getSemorYear(courcenamecombo.getSelectedItem()+"")));
+ String[] totalsub=new SubjectData().getSubjectinCource(fm.f.getCourceCode(), fm.f.getSemorYear());
+ subjectorrollcombo.setModel(new DefaultComboBoxModel(totalsub));
+ semoryearcombo.setSelectedIndex(fm.f.getSemorYear());
+ subjectorrollcombo.setSelectedItem(fm.f.getSubject());
+ courcenamecombo.setVisible(false);
+ semoryearcombo.setVisible(false);
+ label3.setLocation(label1.getLocation());
+ label1.setVisible(false);
+ label2.setVisible(false);
+ subjectorrollcombo.setLocation(courcenamecombo.getLocation());
+ this.fetchdetailsbutton.setLocation(fetchdetailsbutton.getX(),semoryearcombo.getY());
+ scrollPane.setLocation(scrollPane.getX(),fetchdetailsbutton.getY()+50);
+ table.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ if(e.getClickCount()>1 && e.getButton()==MouseEvent.BUTTON1)
+ {
+
+ JTable t=(JTable) e.getSource();
+ int row=t.getSelectedRow();
+
+ String strsem=table.getValueAt(row, 2)+"";
+ int sem=Integer.parseInt(strsem.substring(strsem.indexOf('-')+1));
+ String courcecode=strsem.substring(0,strsem.indexOf('-'));
+ String strroll=table.getValueAt(row, 0)+"";
+ long rollnumber=Long.parseLong(strroll);
+ Student s=new StudentData().getStudentDetails(courcecode,sem,rollnumber);
+
+ fm.viewstudentpanel=new ViewStudentPanel(s,fm,fm.marksheetreportpanelscroll);
+ fm.viewstudentpanel.setVisible(true);
+ fm.marksheetreportpanelscroll.setVisible(false);
+ fm.viewstudentpanel.setLocation(fm.panelx,0);
+ fm.viewstudentpanel.setVisible(true);
+ fm.viewstudentpanel.setFocusable(true);
+ fm.contentPane.add(fm.viewstudentpanel);
+ }
+
+ }
+ });
+ studentwicebutton.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ // TODO Auto-generated method stub
+ activeButton(studentwicebutton);
+ disableButton(subjectwicebutton);
+ disableButton(classwicebutton);
+ disableButton(declareresultbutton);
+ label3.setVisible(true);
+ subjectorrollcombo.setVisible(true);
+ label3.setText("Select Roll Number :");
+ fetchdetailsbutton.setVisible(true);
+ subjectorrollcombo.setLocation(courcenamecombo.getLocation());
+ fetchdetailsbutton.setLocation(fetchdetailsbutton.getX(),semoryearcombo.getY());
+ scrollPane.setLocation(scrollPane.getX(),fetchdetailsbutton.getY()+50);
+ subjectorrollcombo.setModel(new DefaultComboBoxModel(new StudentData().getRollNumber(fm.f.getCourceCode(), semoryearcombo.getSelectedIndex())));
+ scrollPane.setVisible(false);
+
+ }
+
+ }
+ );
+ subjectwicebutton.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ // TODO Auto-generated method stub
+ activeButton(subjectwicebutton);
+ disableButton(studentwicebutton);
+ disableButton(classwicebutton);
+ disableButton(declareresultbutton);
+ label3.setVisible(true);
+ subjectorrollcombo.setVisible(true);
+ label3.setText("Select Subject :");
+ fetchdetailsbutton.setVisible(true);
+ subjectorrollcombo.setLocation(courcenamecombo.getLocation());
+ fetchdetailsbutton.setLocation(fetchdetailsbutton.getX(),semoryearcombo.getY());
+ scrollPane.setLocation(scrollPane.getX(),fetchdetailsbutton.getY()+50);
+ String[] totalsub=new SubjectData().getSubjectinCource(fm.f.getCourceCode(), fm.f.getSemorYear());
+ subjectorrollcombo.setModel(new DefaultComboBoxModel(totalsub));
+ scrollPane.setVisible(false);
+
+ }
+
+ }
+ );
+ classwicebutton.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ // TODO Auto-generated method stub
+ subjectwicebutton.setName("Active");
+ activeButton(classwicebutton);
+ disableButton(studentwicebutton);
+ disableButton(subjectwicebutton);
+ disableButton(declareresultbutton);
+ subjectorrollcombo.setVisible(false);
+ label3.setVisible(false);
+ scrollPane.setLocation(scrollPane.getX(), courcenamecombo.getY());
+ fetchdetailsbutton.setVisible(false);
+ createtablemodel();
+ }
+
+ }
+ );
+
+ }
+ public void activeButton(JButton button)
+ {
+ if(submitbutton!=null)
+ {
+ submitbutton.setVisible(false);
+ }
+ button.setBorder(new LineBorder(new Color(255, 255, 255)));
+ button.setForeground(new Color(0, 139, 139));
+ button.setBackground(new Color(255, 255, 255));
+ button.setFocusPainted(false);
+ button.setName("Active");
+ }
+ public void disableButton(JButton button)
+ {
+
+ button.setBorder(new LineBorder(new Color(255, 255, 255)));
+ button.setForeground(new Color(255, 255, 255));
+ button.setBackground(new Color(32, 178, 170));
+ button.setFocusPainted(false);
+ button.setName("Deactive");
+ }
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ Errorlabel.setVisible(false);
+ if(e.getSource()==courcenamecombo)
+ {
+ courcenamecombo.setFocusable(false);
+
+ subjectorrollcombo.setModel(new DefaultComboBoxModel(new String[] {""}));
+ if(courcenamecombo.getSelectedIndex()==0)
+ {
+ semoryearcombo.setModel(new DefaultComboBoxModel(new String[] {""}));
+
+ }
+ else
+ {
+ String cource=(String) courcenamecombo.getSelectedItem();
+
+ semoryearcombo.setModel(new DefaultComboBoxModel(new CourceData().getSemorYear(cource)));
+ }
+
+ }
+ if(e.getSource()==semoryearcombo && semoryearcombo.getSelectedIndex()>0)
+ {
+ String cource=(String) courcenamecombo.getSelectedItem();
+
+ if(subjectwicebutton.getName().equals("Active"))
+ {
+ String[] totalsub=new SubjectData().getSubjectinCource(new CourceData().getCourcecode(cource), semoryearcombo.getSelectedIndex());
+ if(totalsub!=null)
+ {
+ subjectorrollcombo.setModel(new DefaultComboBoxModel(totalsub));
+ }
+ else
+ {
+
+ subjectorrollcombo.setModel(new DefaultComboBoxModel(new String[] {"No Subject Found"}));
+ }
+ }
+ else if(studentwicebutton.getName().equals("Active"))
+ {
+ subjectorrollcombo.setModel(new DefaultComboBoxModel(new StudentData().getRollNumber(new CourceData().getCourcecode(cource), semoryearcombo.getSelectedIndex())));
+ }
+ }
+ else if(e.getSource()==semoryearcombo)
+ {
+ subjectorrollcombo.setModel(new DefaultComboBoxModel(new String[] {""}));
+ }
+ if(e.getSource()==fetchdetailsbutton)
+ {
+
+ if(declareresultbutton.getName().equals("Active"))
+ {
+
+ if(courcenamecombo.getSelectedIndex()==0)
+ {
+ showerror(courcenamecombo);
+ }
+ else
+ {
+ createTableForDeclareResult(courcenamecombo.getSelectedItem()+"");
+ }
+ }
+ else
+ {
+ if(courcenamecombo.getSelectedIndex()==0)
+ {
+ showerror(courcenamecombo);
+ }
+ else if(semoryearcombo.getSelectedIndex()==0)
+ {
+ showerror(semoryearcombo);
+ }
+ else if(subjectorrollcombo.isVisible() && subjectorrollcombo.getSelectedItem().equals("No Subject Found"))
+ {
+ Component tf=subjectorrollcombo;
+ Errorlabel.setVisible(true);
+ Errorlabel.setText("No Subject Found !");
+ Errorlabel.setBounds(tf.getX(), tf.getY()+tf.getHeight()-5, 400,26);
+ }
+ else if(subjectorrollcombo.isVisible() && subjectorrollcombo.getSelectedIndex()==0)
+ {
+ showerror(subjectorrollcombo);
+ }
+
+ else
+ {
+ this.createtablemodel();
+
+ }
+ }
+ }
+ }
+ public void showerror(JComponent tf)
+ {
+ Errorlabel.setVisible(true);
+ Errorlabel.setText("This is required question !");
+ Errorlabel.setBounds(tf.getX(), tf.getY()+tf.getHeight()-5, 400,26);
+ }
+ public void createTableForDeclareResult(String cource)
+ {
+ submitbutton.setVisible(true);
+ String columnname[]= {"Cource","Sem","Cource Name",""};
+ DefaultTableModel model=new DefaultTableModel(columnname,0)
+ {
+ boolean isEdit[]= {false,false,false,true};
+ @Override
+ public boolean isCellEditable(int row,int column)
+ {
+ return isEdit[column];
+ }
+ @Override
+ public Class> getColumnClass(int column)
+ {
+ switch(column)
+ {
+ case 0: return String.class;
+ case 1: return String.class;
+ case 2:return String.class;
+ case 3:return Boolean.class;
+ default:return String.class;
+ }
+ }
+ };
+ ArrayList list=new CourceData().getCourcesForDeclareResult(cource);
+ for(int i=0; i list=null;
+ if(studentwicebutton.getName().equals("Active"))
+ {
+ list=new StudentData().getMarkssheetOfStudent(m.getCourceCode(), m.getSemorYear(), m.getRollNumber());
+ }
+ else if(subjectwicebutton.getName().equals("Active"))
+ {
+ list=new StudentData().getMarksheetReportBySubject(m);
+ }
+ else if(classwicebutton.getName().equals("Active"))
+ {
+ list=new StudentData().getMarksheetReportByClass(m);
+ }
+ for(int i=0; i1 && e.getButton()==MouseEvent.BUTTON1&&!declareresultbutton.getName().equals("Active"))
+ {
+
+ JTable t=(JTable) e.getSource();
+ int row=t.getSelectedRow();
+
+ String strsem=table.getValueAt(row, 2)+"";
+ int sem=Integer.parseInt(strsem.substring(strsem.indexOf('-')+1));
+ String courcecode=strsem.substring(0,strsem.indexOf('-'));
+ String strroll=table.getValueAt(row, 0)+"";
+ long rollnumber=Long.parseLong(strroll);
+ Student s=new StudentData().getStudentDetails(courcecode,sem,rollnumber);
+
+ am.viewstudentpanel=new ViewStudentPanel(s,am,am.marksheetreportpanelscroll);
+ am.viewstudentpanel.setVisible(true);
+ am.marksheetreportpanelscroll.setVisible(false);
+ am.viewstudentpanel.setLocation(am.panelx,0);
+ am.viewstudentpanel.setVisible(true);
+ am.viewstudentpanel.setFocusable(true);
+ am.contentPane.add(am.viewstudentpanel);
+ }
+
+ }
+
+ }
+ private class DeclareResult implements ActionListener
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO Auto-generated method stub
+ for(int i=0; i0)
+ {
+ this.reArrangeChatSrNoColumn();
+ }
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return result;
+ }
+ public void reArrangeChatSrNoColumn()
+ {
+
+ try
+ {
+ String query="alter table chat drop sr_no;";
+ PreparedStatement pr=con.prepareStatement(query);
+ pr.executeUpdate();
+ query="alter table chat add sr_no int primary key auto_increment first";
+ pr=con.prepareStatement(query);
+ pr.executeUpdate();
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ }
+ public int deleteNotificationHistory(Student s)
+ {
+ int result=0;
+ String query="delete from notification where userid='"+s.getUserId()+"'";
+ try
+ {
+ PreparedStatement pr=con.prepareStatement(query);
+ result=pr.executeUpdate();
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return result;
+
+ }
+ public int deleteOldOptionalSubjectMarks(Student s)
+ {
+ int result=0;
+ try
+ {
+ String query="delete from marks where courcecode='"+s.getCourceCode()+"' and semoryear="+s.getSemorYear()+" and rollnumber="+s.getRollNumber()+" and subjectname='"+s.getOptionalSubject()+"'";
+ PreparedStatement pr=con.prepareStatement(query);
+ result=pr.executeUpdate();
+
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return result;
+ }
+
+ public int updateStudentData(Student sold,Student s)
+ {
+ int result=0;
+ String query="update students set Courcecode=?,semoryear=?,rollnumber=?,optionalsubject=?,firstname=?,lastname=?,emailid=?,contactnumber=?,dateofbirth=?,gender=?,state=?,city=?,fathername=?,fatheroccupation=?,mothername=?,motheroccupation=?,profilepic=?,lastlogin=?,activestatus=?,userid=? where courcecode='"+sold.getCourceCode()+"' and semoryear="+sold.getSemorYear()+" and rollnumber="+sold.getRollNumber();
+
+ //if cource or sem or rollnumber is changed
+ if(!s.getCourceCode().equals(sold.getCourceCode()) || s.getSemorYear()!=sold.getSemorYear() || s.getRollNumber()!=sold.getRollNumber())
+ {
+
+
+ //Adding notification
+ {
+ Notification n=new Notification();
+ n.setUserProfile("Student");
+ n.setCourceCode(s.getCourceCode());
+ n.setSemorYear(s.getSemorYear());
+ n.setTitle("New Student");
+ n.setUserId(s.generateUserId());
+ n.setMessage(s.getFullName()+" ("+s.getRollNumber()+") has taken admission in your class.");
+ n.setTime(TimeUtil.getCurrentTime());
+ new NotificationData().addNotification(n);
+ n.setUserProfile("Faculty");
+ new NotificationData().addNotification(n);
+ }
+ //deleting all the data of student from this cource
+ this.deleteMarksData(sold);
+ this.deleteAttandanceData(sold);
+ this.deleteUsersHistory(sold);
+ this.deleteNotificationHistory(sold);
+ this.deleteChatHistory(sold);
+ }
+
+ if(!s.getOptionalSubject().equals(sold.getOptionalSubject()))
+ {
+ this.deleteOldOptionalSubjectMarks(sold);
+ }
+ try
+ {
+
+ PreparedStatement pr=con.prepareStatement(query);
+ pr.setString(1, s.getCourceCode());
+ pr.setInt(2,s.getSemorYear());
+ pr.setLong(3,s.getRollNumber());
+ pr.setString(4, s.getOptionalSubject());
+ pr.setString(5,s.getFirstName());
+ pr.setString(6, s.getLastName());
+ pr.setString(7, s.getEmailId());
+ pr.setString(8, s.getContactNumber());
+ pr.setString(9,s.getBirthDate());
+ pr.setString(10, s.getGender());
+ pr.setString(11, s.getState());
+ pr.setString(12, s.getCity());
+ pr.setString(13,s.getFatherName());
+ pr.setString(14,s.getFatherOccupation());
+ pr.setString(15, s.getMotherName());
+ pr.setString(16, s.getMotherOccupation());
+ pr.setBytes(17, s.getProfilePicInBytes());
+ pr.setString(18, s.getLastLogin());
+ pr.setBoolean(19, s.getActiveStatus());
+ pr.setString(20,s.generateUserId());
+ result=pr.executeUpdate();
+
+
+ pr.close();
+ return result;
+
+ }
+
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ return result;
+ }
+
+ public int getTotalStudentInCource(String Courcecode,int sem)
+ {
+ int rollnumber=0;
+
+ String query="select rollnumber from students where courcecode='"+Courcecode+"' and semoryear="+sem;
+ try
+ {
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+
+ while(rs.next())
+ {
+ rollnumber++;
+ }
+ st.close();
+ rs.close();
+ return rollnumber;
+ }
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ return rollnumber;
+ }
+ public String[] getRollNumber(String Courcecode,int sem)
+ {
+ String rollnumber[]=null;
+ int i=0;
+ String query="select rollnumber from students where courcecode='"+Courcecode+"' and semoryear="+sem+" order by rollnumber asc";
+ try
+ {
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ long num;
+ rollnumber=new String[this.getTotalStudentInCource(Courcecode, sem)+1];
+ rollnumber[i++]="---Select Rollnumber---";
+ while(rs.next())
+ {
+ num=rs.getLong(1);
+ rollnumber[i++]=num+"";
+
+ }
+ return rollnumber;
+ }
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ return rollnumber;
+ }
+ public ResultSet getStudentinfo(String condition)
+ {
+ ResultSet rs=null;
+ String query="select s.courcecode as 'Class' ,s.rollnumber as 'Roll Number',concat(s.firstname,' ',s.lastname) as 'Student Name',c.courcename as 'Cource Name',concat(c.semoryear,'-',s.semoryear) as 'Sem/Year' from students s ,cources c where s.courcecode=c.courcecode "+condition+" order by s.courcecode asc,s.semoryear asc,s.rollnumber asc";
+
+ try
+ {
+ Statement st=con.createStatement();
+ rs=st.executeQuery(query);
+ return rs;
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ return rs;
+ }
+
+ public ResultSet searchStudent(String query)
+ {
+
+ query+=" order by s.courcecode asc,s.semoryear asc,s.rollnumber asc";
+ ResultSet rs=null;
+ try
+ {
+ Statement st=con.createStatement();
+ rs=st.executeQuery(query);
+ return rs;
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ return rs;
+ }
+ public Student getStudentDetails(String Courcecode,int sem,long rollnumber)
+ {
+ Student s=new Student();
+
+ String query=" select * from students where courcecode='"+Courcecode+"' and semoryear="+sem+" and rollnumber="+rollnumber;
+ try
+ {
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ s.setCourceCode(rs.getString(1));
+ s.setSemorYear(rs.getInt(2));
+ s.setRollNumber(rs.getLong(3));
+ s.setOptionalSubject(rs.getString(4));
+ s.setFirstName(rs.getString(5));
+ s.setLastName(rs.getString(6));
+ s.setEmailId(rs.getString(7));
+ s.setContactNumber(rs.getString(8));
+ s.setBirthDate(rs.getString(9));
+ s.setGender(rs.getString(10));
+ s.setState(rs.getString(11));
+ s.setCity(rs.getString(12));
+ s.setFatherName(rs.getString(13));
+ s.setFatherOccupation(rs.getString(14));
+ s.setMotherName(rs.getString(15));
+ s.setMotherOccupation(rs.getString(16));
+ s.setProfilePic(rs.getBytes(17));
+ s.setSrNo(rs.getInt(18));
+ s.setLastLogin(rs.getString(19));
+ s.setUserId(rs.getString(20));
+ s.setPassword(rs.getString(21));
+ s.setActiveStatus(rs.getBoolean(22));
+ s.setAdmissionDate(rs.getString(23));
+
+ return s;
+ }
+
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ return s;
+ }
+ public int addStudentTheoryMarks(Marks m)
+ {
+ int result=0;
+ try
+ {
+
+ String query="update marks set theorymarks="+m.getTheoryMarks()+" where subjectcode='"+m.getSubjectCode()+"' and rollnumber="+m.getRollNumber();
+ PreparedStatement pr=con.prepareStatement(query);
+ result=pr.executeUpdate();
+ if(result==0)
+ {
+ query="insert into marks values(?,?,?,?,?,?,?)";
+ pr=con.prepareStatement(query);
+ pr.setString(1, m.getCourceCode());
+ pr.setInt(2, m.getSemorYear());
+ pr.setString(3, m.getSubjectCode());
+ pr.setString(4, m.getSubjectName());
+ pr.setLong(5, m.getRollNumber());
+ pr.setInt(6, m.getTheoryMarks());
+
+ pr.setInt(7,Types.NULL);
+ result=pr.executeUpdate();
+ }
+ }
+ catch(Exception exp)
+ {
+
+ }
+ return result;
+
+ }
+
+ public int addStudentPracticalMarks(Marks m)
+ {
+ int result=0;
+ try
+ {
+ String query="update marks set practicalmarks="+m.getPracticalMarks()+" where subjectcode='"+m.getSubjectCode()+"' and rollnumber="+m.getRollNumber();
+ PreparedStatement pr=con.prepareStatement(query);
+ result=pr.executeUpdate();
+ if(result==0)
+ {
+ query="insert into marks values(?,?,?,?,?,?,?)";
+ pr=con.prepareStatement(query);
+ pr.setString(1, m.getCourceCode());
+ pr.setInt(2, m.getSemorYear());
+ pr.setString(3, m.getSubjectCode());
+ pr.setString(4, m.getSubjectName());
+ pr.setLong(5, m.getRollNumber());
+ pr.setInt(6, Types.NULL);
+ pr.setInt(7,m.getPracticalMarks());
+ result=pr.executeUpdate();
+ }
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return result;
+
+ }
+ public ArrayList getStudentTheoryMarksDetails(String Courcecode,int sem,String subjectname)
+ {
+ ResultSet rs=null;
+ ArrayList marks=new ArrayList();
+ String subjectcode=new SubjectData().getSubjectCode(Courcecode, sem, subjectname);
+ String query="select distinct s.firstname,s.rollnumber,subject.subjectname,subject.theorymarks,m.theorymarks from students s left join marks m on s.rollnumber=m.rollnumber and m.subjectcode='"+subjectcode+"',subject where s.courcecode='"+Courcecode+"' and s.semoryear="+sem+" and subject.subjectcode='"+subjectcode+"' order by s.rollnumber asc";
+ String subjecttype=new SubjectData().checkCoreorOptional(subjectcode);
+ if(!subjecttype.equals("core"))
+ {
+ query="select distinct s.firstname,s.rollnumber,subject.subjectname,subject.theorymarks,m.theorymarks from students s left join marks m on s.rollnumber=m.rollnumber and m.subjectcode='"+subjectcode+"',subject where s.optionalsubject=subject.subjectname and s.courcecode='"+Courcecode+"' and s.semoryear="+sem+" and subject.subjectcode='"+subjectcode+"' order by s.rollnumber asc";
+
+ }
+ try
+ {
+ Statement st=con.createStatement();
+ rs=st.executeQuery(query);
+ while(rs.next())
+ {
+ Marks m=new Marks();
+ m.setRollNumber(rs.getLong(2));
+ m.setStudentName(rs.getString(1));
+ m.setSubjectName(rs.getString(3));
+ m.setMaxTheoryMarks(rs.getInt(4));
+ m.setTheoryMarks(rs.getInt(5));
+ marks.add(m);
+
+ }
+ st.close();
+ }
+
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ return marks;
+ }
+ public ArrayList getStudentPracticalMarksDetails(String Courcecode,int sem,String subjectname)
+ {
+ ResultSet rs=null;
+ ArrayList marks=new ArrayList();
+ String subjectcode=new SubjectData().getSubjectCode(Courcecode, sem, subjectname);
+ String query="select distinct s.firstname,s.rollnumber,subject.subjectname,subject.practicalmarks,m.practicalmarks from students s left join marks m on s.rollnumber=m.rollnumber and m.subjectcode='"+subjectcode+"',subject where s.courcecode='"+Courcecode+"' and s.semoryear="+sem+" and subject.subjectcode='"+subjectcode+"' order by s.rollnumber asc";
+ String subjecttype=new SubjectData().checkCoreorOptional(subjectcode);
+ if(!subjecttype.equals("core"))
+ {
+ query="select distinct s.firstname,s.rollnumber,subject.subjectname,subject.practicalmarks,m.practicalmarks from students s left join marks m on s.rollnumber=m.rollnumber and m.subjectcode='"+subjectcode+"',subject where s.optionalsubject=subject.subjectname and s.courcecode='"+Courcecode+"' and s.semoryear="+sem+" and subject.subjectcode='"+subjectcode+"' order by s.rollnumber asc";
+
+ }
+ try
+ {
+ Statement st=con.createStatement();
+ rs=st.executeQuery(query);
+ while(rs.next())
+ {
+ Marks m=new Marks();
+ m.setRollNumber(rs.getLong(2));
+ m.setStudentName(rs.getString(1));
+ m.setSubjectName(rs.getString(3));
+ m.setMaxPracticalMarks(rs.getInt(4));
+ m.setPracticalMarks(rs.getInt(5));
+ marks.add(m);
+
+ }
+ st.close();
+ }
+
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ return marks;
+ }
+ public Student getStudentDetails(int row)
+ {
+ Student s=new Student();
+ String query="select * from students where sr_no="+row;
+ try
+ {
+
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ s.setCourceCode(rs.getString(1));
+ s.setSemorYear(rs.getInt(2));
+ s.setRollNumber(rs.getLong(3));
+ s.setOptionalSubject(rs.getString(4));
+ s.setFirstName(rs.getString(5));
+ s.setLastName(rs.getString(6));
+ s.setEmailId(rs.getString(7));
+ s.setContactNumber(rs.getString(8));
+ s.setBirthDate(rs.getString(9));
+ s.setGender(rs.getString(10));
+ s.setState(rs.getString(11));
+ s.setCity(rs.getString(12));
+ s.setFatherName(rs.getString(13));
+ s.setFatherOccupation(rs.getString(14));
+ s.setMotherName(rs.getString(15));
+ s.setMotherOccupation(rs.getString(16));
+ s.setProfilePic(rs.getBytes(17));
+ s.setSrNo(rs.getInt(18));
+ s.setLastLogin(rs.getString(19));
+ s.setUserId(rs.getString(20));
+ s.setPassword(rs.getString(21));
+ s.setActiveStatus(rs.getBoolean(22));
+ s.setAdmissionDate(rs.getString(23));
+ return s;
+
+ }
+
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ return s;
+ }
+ public Student getStudentDetailsByUserId(String userid)
+ {
+ Student s=new Student();
+ String query="select * from students where userid='"+userid+"'";
+ try
+ {
+
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ s.setCourceCode(rs.getString(1));
+ s.setSemorYear(rs.getInt(2));
+ s.setRollNumber(rs.getLong(3));
+ s.setOptionalSubject(rs.getString(4));
+ s.setFirstName(rs.getString(5));
+ s.setLastName(rs.getString(6));
+ s.setEmailId(rs.getString(7));
+ s.setContactNumber(rs.getString(8));
+ s.setBirthDate(rs.getString(9));
+ s.setGender(rs.getString(10));
+ s.setState(rs.getString(11));
+ s.setCity(rs.getString(12));
+ s.setFatherName(rs.getString(13));
+ s.setFatherOccupation(rs.getString(14));
+ s.setMotherName(rs.getString(15));
+ s.setMotherOccupation(rs.getString(16));
+ s.setProfilePic(rs.getBytes(17));
+ s.setSrNo(rs.getInt(18));
+ s.setLastLogin(rs.getString(19));
+ s.setUserId(rs.getString(20));
+ s.setPassword(rs.getString(21));
+ s.setActiveStatus(rs.getBoolean(22));
+ s.setAdmissionDate(rs.getString(23));
+
+ return s;
+
+ }
+
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ return s;
+ }
+ public int getTotalStudents()
+ {
+ int totalstudent=0;
+ try
+ {
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery("select * from students");
+ while(rs.next())
+ {
+ totalstudent++;
+ }
+ rs.close();
+ st.close();
+ return totalstudent;
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ return totalstudent;
+ }
+
+ public Marks getOptionalSubjectMarks(String courcecode,int semoryear,long rollnumber)
+ {
+ try
+ {
+ Marks m=new Marks();
+ m.setCourceCode(courcecode);
+ m.setSemorYear(semoryear);
+ m.setRollNumber(rollnumber);
+ String scode=this.getOptionalSubjectCode(courcecode,semoryear,rollnumber);
+ if(scode==null)
+ {
+ return null;
+ }
+ String query="select su.subjectcode,su.subjectname,su.theorymarks,m.theorymarks,su.practicalmarks,m.practicalmarks from subject su left join marks m on m.subjectcode='"+scode+"' and m.rollnumber="+rollnumber+" where su.subjectcode='"+scode+"'";
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ m.setSubjectCode(rs.getString(1));
+ m.setSubjectName(rs.getString(2));
+ m.setMaxTheoryMarks(rs.getInt(3));
+ m.setTheoryMarks(rs.getInt(4));
+ m.setMaxPracticalMarks(rs.getInt(5));
+ m.setPracticalMarks(rs.getInt(6));
+ m.setRollNumber(rollnumber);
+ m.setStudentName(getStudentName(courcecode+"-"+semoryear+"-"+rollnumber));
+ return m;
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return null;
+ }
+ public String getOptionalSubjectCode(String courcecode,int semoryear,long rollnumber)
+ {
+ String osub=null;
+
+ try
+ {
+ String query="select optionalsubject from students where userid='"+courcecode+"-"+semoryear+"-"+rollnumber+"'";
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ osub=rs.getString(1);
+ osub=new SubjectData().getSubjectCode(courcecode, semoryear, osub);
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return osub;
+
+ }
+ public ArrayList getMarkssheetOfStudent(String courcecode,int sem,long rollnumber)
+ {
+ ArrayList list=new ArrayList();
+ String query="select su.subjectcode,su.subjectname,su.theorymarks,m.theorymarks,su.practicalmarks,m.practicalmarks from subject su left join marks m on su.subjectname=m.subjectname and m.rollnumber="+rollnumber+" and m.semoryear="+sem+" and m.courcecode='"+courcecode+"' where su.courcecode='"+courcecode+"' and su.semoryear="+sem+" and su.subjecttype='core' order by su.subjectcode asc";
+ try
+ {
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ int index=1;
+ while(rs.next())
+ {
+ Marks m=new Marks();
+
+ m.setSrNo(index);
+ m.setSubjectCode(rs.getString(1));
+ m.setSubjectName(rs.getString(2));
+ m.setMaxTheoryMarks(rs.getInt(3));
+ m.setTheoryMarks(rs.getInt(4));
+ m.setMaxPracticalMarks(rs.getInt(5));
+ m.setPracticalMarks(rs.getInt(6));
+ m.setRollNumber(rollnumber);
+ m.setStudentName(getStudentName(courcecode+"-"+sem+"-"+rollnumber));
+ index++;
+ list.add(m);
+ }
+ {
+ Marks m=getOptionalSubjectMarks(courcecode,sem,rollnumber);
+ if(m!=null)
+ {
+ m.setSrNo(index);
+ list.add(m);
+ }
+ }
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return list;
+ }
+ public int addStudentAttandance(Attandance a)
+ {
+ int result=0;
+ try
+ {
+
+ String query="insert into attandance values(?,?,?,?,?,?)";
+ PreparedStatement pr=con.prepareStatement(query);
+ pr.setString(1, a.getSubjectCode());
+ pr.setString(2, a.getAttandanceDate());
+ pr.setLong(3, a.getRollNumber());
+ pr.setBoolean(4,a.getPresentStatus());
+ pr.setString(5,a.getCourceCode());
+ pr.setInt(6,a.getSemorYear());
+ result=pr.executeUpdate();
+
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ return result;
+ }
+ public ArrayList getStudentsForAttandance(Attandance a)
+ {
+ ArrayList list=new ArrayList();
+ String query="select s.rollnumber,concat(s.firstname,' ',s.lastname),s.semoryear,a.present from students s left join attandance a on"
+ + " s.rollnumber=a.rollnumber"
+ + " and a.date='"+a.getAttandanceDate()+"'"
+ + " and a.subjectcode='"+a.getSubjectCode()+"'"
+ + " where s.courcecode='"+a.getCourceCode()+"'"
+ + " and s.semoryear="+a.getSemorYear();
+ String subjecttype=new SubjectData().checkCoreorOptional(a.getSubjectCode());
+ if(!subjecttype.equals("core"))
+ {
+ query+=" and s.optionalsubject='"+a.getSubjectName()+"'";
+ }
+ query+=" order by s.rollnumber asc";
+ try
+ {
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ while(rs.next())
+ {
+ Attandance at=new Attandance();
+ at.setRollNumber(rs.getLong(1));
+ at.setStudentName(rs.getString(2));
+ at.setSemorYear(rs.getInt(3));
+ at.setPresentStatus(rs.getBoolean(4));
+ at.setCourceCode(a.getCourceCode());
+ at.setSubjectName(a.getSubjectName());
+ list.add(at);
+
+ }
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return list;
+ }
+ public boolean isSubmitted(String subjectcode,String date)
+ {
+ try
+ {
+ String query=" select count(*) from attandance where "
+ + "subjectcode='"+subjectcode
+ + "'"
+ + " and date='"+date
+ + "'";
+
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ return rs.getInt(1)>0?true:false;
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return false;
+ }
+ public ArrayList getAttandanceReportBySubject(Attandance a)
+ {
+ ArrayList list=new ArrayList();
+ try
+ {
+ String query="select distinct s.rollnumber,concat(s.firstname,' ',s.lastname) as 'Student Name',(select count(*) from attandance where "
+ + "subjectcode='"+a.getSubjectCode()
+ + "' and rollnumber=s.rollnumber and present=1),(select count(*) from attandance where subjectcode='"+a.getSubjectCode()+"' and rollnumber=s.rollnumber)"
+ + "from students s left join attandance a on s.rollnumber=a.rollnumber where "
+ + "s.courcecode='"+a.getCourceCode()
+ + "' and s.semoryear="+a.getSemorYear()+" ";
+ String subjecttype=new SubjectData().checkCoreorOptional(a.getSubjectCode());
+ if(!subjecttype.equals("core"))
+ {
+ query+=" and s.optionalsubject='"+a.getSubjectName()+"'";
+ }
+ query+=" order by s.rollnumber asc";
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ while(rs.next())
+ {
+ Attandance at=new Attandance();
+ at.setRollNumber(rs.getLong(1));
+ at.setStudentName(rs.getString(2));
+ at.setCourceCode(a.getCourceCode());
+ at.setSubjectName(a.getSubjectName());
+ at.setAttandance(rs.getInt(3));
+ at.setTotalAttandance(rs.getInt(4));
+ list.add(at);
+ }
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return list;
+
+ }
+ public ArrayList getMarksheetReportBySubject(Marks marks)
+ {
+ ArrayList list=new ArrayList();
+ try
+ {
+ String query="select distinct s.rollnumber,concat(s.firstname,' ',s.lastname) as 'Student Name'"
+ + ",(select theorymarks from marks where "
+ + "subjectcode='"+marks.getSubjectCode()
+ + "' and rollnumber=s.rollnumber) as 'Theory'"
+ + ",(select practicalmarks from marks where"
+ + " subjectcode='"+marks.getSubjectCode()
+ + "' and rollnumber=s.rollnumber) as 'Practical',"
+ + "(select theorymarks from subject where subjectcode='"+marks.getSubjectCode()
+ + "') as 'Total theory',(select practicalmarks from subject where subjectcode='"+marks.getSubjectCode()
+ + "') as 'Total Practical' from students s left join marks m on s.rollnumber=m.rollnumber where s.courcecode='"+marks.getCourceCode()
+ + "' and s.semoryear="+marks.getSemorYear();
+ String subjecttype=new SubjectData().checkCoreorOptional(marks.getSubjectCode());
+ if(!subjecttype.equals("core"))
+ {
+ query+=" and s.optionalsubject='"+marks.getSubjectName()+"'";
+ }
+ query+=" order by s.rollnumber asc";
+
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ while(rs.next())
+ {
+ Marks m=new Marks();
+ m.setRollNumber(rs.getLong(1));
+ m.setStudentName(rs.getString(2));
+ m.setSubjectName(marks.getSubjectName());
+ m.setTheoryMarks(rs.getInt(3));
+ m.setPracticalMarks(rs.getInt(4));
+ m.setMaxTheoryMarks(rs.getInt(5));
+ m.setMaxPracticalMarks(rs.getInt(6));
+
+ list.add(m);
+ }
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return list;
+
+ }
+ public ArrayList getMarksheetReportByClass(Marks marks)
+ {
+ ArrayList list=new ArrayList();
+ try
+ {
+ String query="select distinct s.rollnumber,concat(s.firstname,' ',s.lastname) as 'Student Name',(select sum(theorymarks) from marks where courcecode=s.courcecode and semoryear=s.semoryear and rollnumber=s.rollnumber) as 'Theory',(select sum(practicalmarks) from marks where courcecode=s.courcecode and semoryear=s.semoryear and rollnumber=s.rollnumber) as 'Practical',(select sum(theorymarks) from subject where courcecode=s.courcecode and semoryear=s.semoryear and subjecttype='core') as 'Total theory',(select sum(practicalmarks) from subject where courcecode=s.courcecode and semoryear=s.semoryear and subjecttype='core' ) as 'Total Practical' from students s left join marks m on s.rollnumber=m.rollnumber where s.courcecode='"+marks.getCourceCode()+"' and s.semoryear="+marks.getSemorYear();
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ while(rs.next())
+ {
+ Marks m=new Marks();
+ String subjectcode=this.getOptionalSubjectCode(marks.getCourceCode(), marks.getSemorYear(), rs.getLong(1));
+ int maxpracticalmarks=new SubjectData().getMaxTheoryMarksOfSubject(subjectcode);
+ int maxtheorymarks=new SubjectData().getMaxPracticalMarksOfSubject(subjectcode);
+
+ m.setRollNumber(rs.getLong(1));
+ m.setStudentName(rs.getString(2));
+ m.setSubjectName(marks.getSubjectName());
+ m.setTheoryMarks(rs.getInt(3));
+ m.setPracticalMarks(rs.getInt(4));
+ m.setMaxTheoryMarks(rs.getInt(5)+maxtheorymarks);
+ m.setMaxPracticalMarks(rs.getInt(6)+maxpracticalmarks);
+
+ list.add(m);
+ }
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return list;
+
+ }
+ public ArrayList getAttandanceReportByClass(Attandance a)
+ {
+ ArrayList list=new ArrayList();
+ try
+ {
+ String query="select distinct s.rollnumber,concat(s.firstname,' ',s.lastname) as 'Student Name',(select count(*) from attandance where "
+ + "courcecode='"+a.getCourceCode()
+ +"' and semoryear="+a.getSemorYear()
+ + " and rollnumber=s.rollnumber and present=1),(select count(*) from attandance where courcecode='"+a.getCourceCode()+"' and semoryear="+a.getSemorYear()+" and rollnumber=s.rollnumber)"
+ + " from students s left join attandance a on s.rollnumber=a.rollnumber where "
+ + "s.courcecode='"+a.getCourceCode()
+ + "' and s.semoryear="+a.getSemorYear()+" order by s.rollnumber";
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ while(rs.next())
+ {
+ Attandance at=new Attandance();
+ at.setRollNumber(rs.getLong(1));
+ at.setStudentName(rs.getString(2));
+ at.setSubjectName("All");
+ at.setAttandance(rs.getInt(3));
+ at.setTotalAttandance(rs.getInt(4));
+
+ list.add(at);
+ }
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return list;
+
+ }
+ public ArrayList getTotalAttandanceReportOfStudent(Attandance a)
+ {
+ ArrayList list=new ArrayList();
+ try
+ {
+ String query="select distinct s.rollnumber,concat(s.firstname,' ',s.lastname) as 'Student Name',(select count(*) from attandance where "
+ + "courcecode='"+a.getCourceCode()
+ +"' and semoryear="+a.getSemorYear()
+ + " and rollnumber=s.rollnumber and present=1),(select count(*) from attandance where courcecode='"+a.getCourceCode()+"' and semoryear="+a.getSemorYear()+" and rollnumber=s.rollnumber)"
+ + " from students s left join attandance a on s.rollnumber=a.rollnumber where "
+ + "s.courcecode='"+a.getCourceCode()
+ + "' and s.semoryear="+a.getSemorYear()
+ + " and s.rollnumber="+a.getRollNumber()
+
+ +" order by s.rollnumber";
+
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ while(rs.next())
+ {
+ Attandance at=new Attandance();
+ at.setRollNumber(rs.getLong(1));
+ at.setStudentName(rs.getString(2));
+ at.setSubjectName("All");
+ at.setAttandance(rs.getInt(3));
+ at.setTotalAttandance(rs.getInt(4));
+
+
+ list.add(at);
+ }
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return list;
+
+ }
+ public ArrayList getAttandanceReportByStudent(Attandance a)
+ {
+ ArrayList list=new ArrayList();
+ try
+ {
+ String query="select distinct su.subjectcode,su.subjectname,(select count(*) from attandance where subjectcode=su.subjectcode "
+ + "and rollnumber="+a.getRollNumber()+" and present=1) as 'Attandance',(select count(*) from attandance where"
+ + " subjectcode=su.subjectcode and rollnumber="+a.getRollNumber()+") as 'Total Attandance' from subject su "
+ + "left join attandance a on su.subjectcode=a.subjectcode where su.courcecode='"+a.getCourceCode()
+ +"' and su.semoryear="+a.getSemorYear()+" order by su.subjectcode asc;";
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ while(rs.next())
+ {
+ Attandance at=new Attandance();
+ at.setStudentName(this.getStudentName(a.getCourceCode()+"-"+a.getSemorYear()+"-"+a.getRollNumber()));
+ at.setRollNumber(a.getRollNumber());;
+ at.setSubjectCode(rs.getString(1));
+ at.setSubjectName(rs.getString(2));
+ at.setAttandance(rs.getInt(3));
+ at.setTotalAttandance(rs.getInt(4));
+ String courcetype=new SubjectData().checkCoreorOptional(at.getSubjectCode());
+ if(!courcetype.equals("core"))
+ {
+ if(at.getSubjectCode().equals(this.getOptionalSubjectCode(a.getCourceCode(), a.getSemorYear(), a.getRollNumber())))
+ {
+ list.add(at);
+ }
+ }
+ else
+ {
+ list.add(at);
+ }
+ }
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return list;
+
+ }
+ public boolean checkPassword(String userid,String password)
+ {
+ boolean result=false;
+ try
+ {
+ String query="select count(*) from students where userid='"+userid+"' and password='"+password+"'";
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ if(rs.getInt(1)>0)
+ {
+ result=true;
+ }
+ else
+ {
+ JOptionPane.showMessageDialog(null, "Incorrect User-Id or Password","Error",JOptionPane.ERROR_MESSAGE);
+ }
+
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return result;
+ }
+ public ArrayList getStudentsDetails(String condition)
+ {
+ ArrayList list=new ArrayList();
+ String query="select * from students s "+condition+" order by s.courcecode asc,s.semoryear asc,s.rollnumber asc";
+ try
+ {
+
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+
+ while(rs.next())
+ {
+ Student s=new Student();
+ s.setCourceCode(rs.getString(1));
+ s.setSemorYear(rs.getInt(2));
+ s.setRollNumber(rs.getLong(3));
+ s.setOptionalSubject(rs.getString(4));
+ s.setFirstName(rs.getString(5));
+ s.setLastName(rs.getString(6));
+ s.setEmailId(rs.getString(7));
+ s.setContactNumber(rs.getString(8));
+ s.setBirthDate(rs.getString(9));
+ s.setGender(rs.getString(10));
+ s.setState(rs.getString(11));
+ s.setCity(rs.getString(12));
+ s.setFatherName(rs.getString(13));
+ s.setFatherOccupation(rs.getString(14));
+ s.setMotherName(rs.getString(15));
+ s.setMotherOccupation(rs.getString(16));
+ s.setProfilePic(rs.getBytes(17));
+ s.setSrNo(rs.getInt(18));
+ s.setLastLogin(rs.getString(19));
+ s.setUserId(rs.getString(20));
+ s.setPassword(rs.getString(21));
+ s.setActiveStatus(rs.getBoolean(22));
+ s.setAdmissionDate(rs.getString(23));
+ list.add(s);
+ }
+
+ }
+
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ return list;
+ }
+ public boolean isActive(String userid)
+ {
+ try
+ {
+ String query="select activestatus from students where userid='"+userid+"'";
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ boolean active=rs.getBoolean(1);
+ st.close();
+ rs.close();
+ return active;
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return false;
+ }
+
+ public String getStudentName(String userid)
+ {
+ String name="";
+ try
+ {
+ String query="select concat(firstname,' ',lastname) from students where userid='"+userid+"'";
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ name=rs.getString(1);
+
+ rs.close();
+ st.close();
+
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return name;
+ }
+ public int setActiveStatus(boolean activestatus,String userid)
+ {
+ int result=0;
+ try
+ {
+ String query="update students set activestatus="+activestatus+" where userid='"+userid+"'";
+ PreparedStatement pr=con.prepareStatement(query);
+ result=pr.executeUpdate();
+ pr.close();
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return result;
+ }
+ public String getLastLogin(String userid)
+ {
+ try
+ {
+ String query="select lastlogin from students where userid='"+userid+"'";
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ return rs.getString(1);
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ return "deleted";
+ }
+ }
+ public Image getProfilePic(String userid)
+ {
+ Image image=null;
+ try
+ {
+ String query="select profilepic from students where userid='"+userid+"'";
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ byte[] imagedata=rs.getBytes(1);
+ image=Toolkit.getDefaultToolkit().createImage(imagedata);
+ rs.close();
+ st.close();
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return image;
+ }
+ public int changePassword(String userid,String password)
+ {
+ try
+ {
+ String query="update students set password='"+password+"' where userid='"+userid+"'";
+ PreparedStatement pr=con.prepareStatement(query);
+ return pr.executeUpdate();
+ }
+ catch(Exception exp)
+ {
+ exp.printStackTrace();
+ }
+ return 0;
+ }
+
+}
+
diff --git a/src/collegeapplication/student/StudentMain.java b/src/collegeapplication/student/StudentMain.java
new file mode 100644
index 0000000..6d10798
--- /dev/null
+++ b/src/collegeapplication/student/StudentMain.java
@@ -0,0 +1,656 @@
+package collegeapplication.student;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.EventQueue;
+import java.awt.Font;
+import java.awt.Image;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+import java.net.Socket;
+
+import javax.imageio.ImageIO;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.SwingConstants;
+import javax.swing.Timer;
+import javax.swing.UIManager;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.LineBorder;
+import javax.swing.border.MatteBorder;
+import javax.swing.plaf.ColorUIResource;
+
+import collegeapplication.admin.AdminProfilePanel;
+import collegeapplication.chat.ChatData;
+import collegeapplication.chat.ChatMainPanel;
+import collegeapplication.common.DataBaseConnection;
+import collegeapplication.common.HomePanel;
+import collegeapplication.common.NotificationData;
+import collegeapplication.common.NotificationPanel;
+import collegeapplication.common.SearchPanel;
+import collegeapplication.common.TimeUtil;
+import collegeapplication.faculty.FacultyPanel;
+import collegeapplication.faculty.ViewFacultyPanel;
+import collegeapplication.login.LoginPageFrame;
+import collegeapplication.subject.AssignSubjectPanel;
+import collegeapplication.subject.SubjectPanel;
+
+/*
+ * Title : StudentMain.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : Student Main Frame
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+@SuppressWarnings("serial")
+public class StudentMain extends JFrame implements ActionListener
+{
+
+ public JPanel contentPane;
+ private JLabel studentnamelabel;
+ private JLabel studentprofilepiclabel;
+ private JPanel profilepanel;
+ private JButton homebutton;
+ private JButton studentsbutton;
+ private JButton subjectbutton;
+ private JButton faculitiesbutton;
+ private JButton marksheetbutton;
+ private JButton attandancereportbutton;
+ private JButton searchbutton;
+ private JButton notificationbutton;
+ private JButton contactusbutton;
+ private JButton logoutbutton;
+ private JButton exitbutton;
+ private Color buttonbcolor=Color.DARK_GRAY;
+ private Color buttonfcolor=Color.LIGHT_GRAY;
+ private Font buttonfont=new Font("Tw Cen MT", Font.PLAIN, 20);
+ public SubjectPanel subjectpanel;
+ public HomePanel homepanel;
+ public StudentPanel studentpanel;
+ public ViewStudentPanel viewstudentpanel;
+ public MarkSheetPanel marksheetpanel;
+ public JScrollPane marksheetpanelscroll;
+ public ViewFacultyPanel viewfacultypanel;
+ public AssignSubjectPanel assignsubjectpanel;
+ public EnterMarksPanel entermarkspanel;
+ public JScrollPane entermarkspanelscroll;
+ private JScrollPane markattandancepanelscroll;
+ public AttandanceReportPanel attandancereportpanel;
+ public JScrollPane attandancereportpanelscroll;
+ public FacultyPanel facultypanel;
+ public AdminProfilePanel adminprofilepanel;
+ public SearchPanel searchpanel;
+ private ChatMainPanel chatmainpanel;
+ public NotificationPanel notificationpanel;
+ public int panely=0,panelx=250;
+ private JButton btn;
+ private JButton myprofilebutton;
+ private String lastlogin;
+ public Student s;
+ private int row=63;
+ private JButton assignedsubjectbutton;
+ private JButton chatbutton;
+ public Socket socket;
+ private Timer timer;
+ private BufferedImage messagecount;
+ private JLabel totalnewnotification;
+ private JLabel totalnewchatmessage;
+ /**
+ * Launch the application.
+ */
+ public static void main(String[] args) {
+ EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ try {
+
+ if(DataBaseConnection.checkconnection())
+ {
+
+ Student s=new StudentData().getStudentDetails("CE",1, 1001);
+ StudentMain frame = new StudentMain(s);
+ frame.setVisible(true);
+ }
+ else
+ {
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ JOptionPane.showMessageDialog(null, "You Are Not Connected To DataBase","Error",JOptionPane.ERROR_MESSAGE);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ }
+
+ /**
+ * Create the frame.
+ */
+ public StudentMain(Student s) {
+
+
+ ActionListener setActive=new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ // TODO Auto-generated method stub
+ int result=new StudentData().setActiveStatus(s.getActiveStatus(), s.getUserId());
+ if(result==0)
+ {
+ timer.stop();
+ JOptionPane.showMessageDialog(null,"Your account is deleted by Admin","Account deleted",JOptionPane.ERROR_MESSAGE);
+ System.exit(0);
+ }
+ else
+ {
+ int notification=new NotificationData().getUnreadNotification(s.getUserId(), "Student", s.getCourceCode(), s.getSemorYear(),s.getAdmissionDate());
+ if(notification>0)
+ {
+ totalnewnotification.setVisible(true);
+ totalnewnotification.setText(notification>999?"999+":notification+"");
+ totalnewnotification.setIcon(new ImageIcon(messagecount.getScaledInstance(24+totalnewnotification.getText().length(), 24, Image.SCALE_SMOOTH)));
+ }
+ int chat=new ChatData().getUndreadMessageCountStudent(s);
+ if(chat>0)
+ {
+ totalnewchatmessage.setText(chat>999?"999+":chat+"");
+ totalnewchatmessage.setVisible(true);
+ totalnewchatmessage.setIcon(new ImageIcon(messagecount.getScaledInstance(26+totalnewchatmessage.getText().length(), 26, Image.SCALE_SMOOTH)));
+ }
+ else if(chat==0)
+ {
+ totalnewchatmessage.setVisible(false);
+ }
+ }
+ }
+
+ };
+ try
+ {
+ messagecount=ImageIO.read(new File("./assets/messagecount.png"));
+ }
+ catch(IOException exp)
+ {
+ exp.printStackTrace();
+ }
+ timer=new Timer(1000,setActive);
+ timer.start();
+ this.s=s;
+ Color bgColor =new Color(32,178,170);
+ Color frColor=Color.white;
+ UIManager.put("ComboBoxUI", "com.sun.java.swing.plaf.windows.WindowsComboBoxUI");
+
+ UIManager.put("ComboBox.selectionBackground", new ColorUIResource(bgColor));
+ UIManager.put("ComboBox.background", new ColorUIResource(Color.white));
+ UIManager.put("ComboBox.foreground", new ColorUIResource(Color.DARK_GRAY));
+ UIManager.put("ComboBox.selectionForeground", new ColorUIResource(frColor));
+ UIManager.put("ScrollBarUI", "com.sun.java.swing.plaf.windows.WindowsScrollBarUI");
+
+ this.setResizable(false);
+ setTitle("Collage Data Management");
+ setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
+ contentPane = new JPanel();
+ contentPane.setForeground(Color.DARK_GRAY);
+ contentPane.setBackground(Color.DARK_GRAY);
+ contentPane.setBorder(new EmptyBorder(0, 0, 0, 0));
+ setContentPane(contentPane);
+ contentPane.setLayout(null);
+
+ this.setBounds(-2,0,1370,733);
+ createpanel();
+ JPanel sidebarpanel = new JPanel();
+ sidebarpanel.setBorder(new MatteBorder(0, 0, 0, 2, (Color) new Color(64, 64, 64)));
+// sidebarpanel.setBackground(new Color(255, 255, 255));
+ sidebarpanel.setBackground(Color.DARK_GRAY);
+ sidebarpanel.setBounds(5, 11, 240, 706);
+ contentPane.add(sidebarpanel);
+ sidebarpanel.setLayout(null);
+
+ profilepanel = new JPanel();
+ profilepanel.setBorder(new MatteBorder(0, 0, 2, 0, (Color) Color.LIGHT_GRAY));
+ profilepanel.setBackground(Color.DARK_GRAY);
+ profilepanel.setBounds(0, 0, 240, 61);
+ sidebarpanel.add(profilepanel);
+ profilepanel.setLayout(null);
+
+ studentnamelabel = new JLabel();
+ studentnamelabel.setForeground(Color.WHITE);
+ studentnamelabel.setHorizontalAlignment(SwingConstants.LEFT);
+ studentnamelabel.setFont(new Font("Tw Cen MT", Font.BOLD, 21));
+ studentnamelabel.setBackground(Color.DARK_GRAY);
+ studentnamelabel.setOpaque(true);
+ studentnamelabel.setBounds(65, 5, 171, 36);
+ profilepanel.add(studentnamelabel);
+
+ studentprofilepiclabel = new JLabel();
+ studentprofilepiclabel.setBounds(5,0, 50, 50);
+ profilepanel.add(studentprofilepiclabel);
+ studentprofilepiclabel.setHorizontalAlignment(SwingConstants.CENTER);
+ studentprofilepiclabel.setBackground(Color.DARK_GRAY);
+
+ studentprofilepiclabel.setBorder(new LineBorder(Color.black,0));
+ studentprofilepiclabel.setOpaque(true);
+
+
+
+
+ homebutton = createButton("Home");
+ sidebarpanel.add(homebutton);
+ btn=homebutton;
+
+ studentsbutton = createButton("Classmates","Students");
+ sidebarpanel.add(studentsbutton);
+
+ subjectbutton =createButton("Subjects");
+ sidebarpanel.add(subjectbutton);
+
+ faculitiesbutton = createButton("Faculities");
+ sidebarpanel.add(faculitiesbutton);
+
+ assignedsubjectbutton = createButton("Assigned Subject","Assign Subject");
+ sidebarpanel.add(assignedsubjectbutton);
+
+ marksheetbutton = createButton("Mark Sheet","Marksheet Report");
+ sidebarpanel.add(marksheetbutton);
+
+ attandancereportbutton = createButton("Attandance Report");
+ sidebarpanel.add(attandancereportbutton);
+
+ chatbutton = createButton("Chat");
+ chatbutton.setLayout(new BorderLayout());
+ sidebarpanel.add(chatbutton);
+ int chat=new ChatData().getUndreadMessageCountStudent(s);
+ totalnewchatmessage=new JLabel();
+ totalnewchatmessage.setSize(60,30);
+ totalnewchatmessage.setFont(new Font("Arial",Font.BOLD,12));
+ totalnewchatmessage.setForeground(Color.white);
+ totalnewchatmessage.setHorizontalTextPosition(JLabel.CENTER);
+ totalnewchatmessage.setVerticalTextPosition(JLabel.CENTER);
+ chatbutton.add(totalnewchatmessage,BorderLayout.LINE_END);
+ System.out.println(chat);
+ if(chat>0)
+ {
+ totalnewchatmessage.setText(chat>999?"999+":chat+"");
+ totalnewchatmessage.setVisible(true);
+ totalnewchatmessage.setIcon(new ImageIcon(messagecount.getScaledInstance(26+totalnewchatmessage.getText().length(), 26, Image.SCALE_SMOOTH)));
+ }
+
+ searchbutton = createButton("Search");
+ sidebarpanel.add(searchbutton);
+
+ notificationbutton = createButton("Notification");
+ notificationbutton.setLayout(new BorderLayout());
+ sidebarpanel.add(notificationbutton);
+
+ int notification=new NotificationData().getUnreadNotification(s.getUserId(), "Student", s.getCourceCode(), s.getSemorYear(),s.getAdmissionDate());
+ totalnewnotification=new JLabel();
+ totalnewnotification.setSize(60,30);
+ totalnewnotification.setFont(new Font("Arial",Font.BOLD,12));
+ totalnewnotification.setForeground(Color.white);
+ totalnewnotification.setHorizontalTextPosition(JLabel.CENTER);
+ totalnewnotification.setVerticalTextPosition(JLabel.CENTER);
+ notificationbutton.add(totalnewnotification,BorderLayout.LINE_END);
+
+ if(notification>0)
+ {
+ totalnewnotification.setText(notification>999?"999+":notification+"");
+ totalnewnotification.setVisible(true);
+ totalnewnotification.setIcon(new ImageIcon(messagecount.getScaledInstance(26+totalnewnotification.getText().length(), 26, Image.SCALE_SMOOTH)));
+ }
+
+
+ myprofilebutton = createButton("My Profile","Profile");
+ sidebarpanel.add(myprofilebutton);
+
+ contactusbutton= createButton("Contact Us");
+ sidebarpanel.add(contactusbutton);
+
+ logoutbutton = createButton("logout");
+ sidebarpanel.add(logoutbutton);
+
+ exitbutton =createButton("Exit");
+ sidebarpanel.add(exitbutton);
+
+ activeButton(homebutton);
+
+ homepanel.setVisible(true);
+
+ this.setCollageDetails();
+ lastlogin=s.getLastLogin();
+ homepanel.setLastLogin(lastlogin);
+
+
+ s.setLastLogin(TimeUtil.getCurrentTime());
+ s.setActiveStatus(true);
+ new StudentData().updateStudentData(s, s);
+ this.addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowClosing(final WindowEvent windowenent) {
+ openPanel(exitbutton);
+ }
+ });
+
+
+
+ }
+ public void createpanel()
+ {
+
+ homepanel=new HomePanel(s);
+ homepanel.setLocation(panelx,panely);
+ homepanel.setVisible(true);
+ homepanel.setFocusable(true);
+ contentPane.add(homepanel);
+
+
+
+ }
+ public void activeButton(JButton button)
+ {
+ btn.setBackground(buttonbcolor);
+ btn.setForeground(buttonfcolor);
+ btn.setFont(buttonfont);
+ btn.setDisabledIcon(new ImageIcon(""));
+ btn.setIcon(new ImageIcon("./assets/"+btn.getName()+"dac.png"));
+ btn=button;
+ btn.setForeground(Color.white);
+ btn.setFont(new Font("Tw Cen MT", Font.BOLD, 23));
+ btn.setIcon(new ImageIcon("./assets/"+btn.getName()+"ac.png"));
+ disablepanel();
+ }
+ public JButton createButton(String text,String name)
+ {
+ JButton button=createButton(text);
+ button.setName(name);
+ button.setIcon(new ImageIcon("./assets/"+button.getName()+"dac.png"));
+ return button;
+ }
+ public JButton createButton(String text)
+ {
+ JButton button=new JButton();
+ button.setForeground(buttonfcolor);
+ button.setFont(buttonfont);
+ button.setBackground(buttonbcolor);
+ button.setHorizontalAlignment(SwingConstants.LEFT);
+ button.setFocusable(false);
+ button.setContentAreaFilled(false);
+ button.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ button.setBorder(new EmptyBorder(0,0,0,0));
+ button.setText(text);
+ button.setName(text);
+ button.setIcon(new ImageIcon("./assets/"+button.getName()+"dac.png"));
+ button.addActionListener(this);
+ button.setIconTextGap(10);
+ button.setLocation(0, row);
+ button.setSize(234, 40);
+ row+=40;
+ return button;
+ }
+ public void disablepanel()
+ {
+ if(homepanel!=null && homepanel.isVisible())
+ {
+ homepanel.setVisible(false);
+ }
+ else if(subjectpanel!=null&&subjectpanel.isVisible())
+ {
+ subjectpanel.setVisible(false);
+ }
+ else if(studentpanel!=null&&studentpanel.isVisible())
+ {
+ studentpanel.setVisible(false);
+ }
+ else if(viewstudentpanel!=null && viewstudentpanel.isVisible())
+ {
+ viewstudentpanel.setVisible(false);
+ }
+ else if(facultypanel!=null && facultypanel.isVisible())
+ {
+ facultypanel.setVisible(false);
+ }
+ else if(viewfacultypanel!=null&&viewfacultypanel.isVisible())
+ {
+ viewfacultypanel.setVisible(false);
+ }
+ else if(assignsubjectpanel!=null &&assignsubjectpanel.isVisible())
+ {
+ assignsubjectpanel.setVisible(false);
+ }
+ else if(entermarkspanelscroll!=null && entermarkspanelscroll.isVisible())
+ {
+ entermarkspanelscroll.setVisible(false);
+ }
+ else if(marksheetpanelscroll!=null&& marksheetpanelscroll.isVisible())
+ {
+ marksheetpanelscroll.setVisible(false);
+ }
+ else if(markattandancepanelscroll!=null && markattandancepanelscroll.isVisible())
+ {
+ markattandancepanelscroll.setVisible(false);
+ }
+ else if(attandancereportpanelscroll!=null && attandancereportpanelscroll.isVisible())
+ {
+ attandancereportpanelscroll.setVisible(false);
+ }
+ else if(adminprofilepanel!=null && adminprofilepanel.isVisible())
+ {
+ adminprofilepanel.setVisible(false);
+ }
+ else if(searchpanel!=null && searchpanel.isVisible())
+ {
+ searchpanel.setVisible(false);
+ }
+ else if(notificationpanel!=null && notificationpanel.isVisible())
+ {
+ notificationpanel.setVisible(false);
+ }
+ else if(chatmainpanel!=null && chatmainpanel.isVisible())
+ {
+ try {
+ if(chatmainpanel.chatpanel.subchatpanel!=null&&chatmainpanel.chatpanel.subchatpanel.socket!=null&&!chatmainpanel.chatpanel.subchatpanel.socket.isClosed())
+ {
+ chatmainpanel.chatpanel.subchatpanel.socket.close();
+ }
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ chatmainpanel.setVisible(false);
+ }
+
+ }
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ this.openPanel(e.getSource());
+ }
+
+
+ public void setCollageDetails()
+ {
+ studentprofilepiclabel.setIcon(new ImageIcon(s.getRoundedProfilePic(50, 50, 50)));
+ studentnamelabel.setText(s.getFullName());
+
+ }
+ public void openPanel(Object source)
+ {
+ if(source==homebutton)
+ {
+ activeButton(homebutton);
+ homepanel=new HomePanel(s);
+ homepanel.setLocation(panelx, panely);
+ homepanel.setFocusable(true);
+ contentPane.add(homepanel);
+ homepanel.setVisible(true);
+ homepanel.setLastLogin(lastlogin);
+ }
+
+ else if(source==subjectbutton)
+ {
+ activeButton(subjectbutton);
+ subjectpanel=new SubjectPanel(this);
+ subjectpanel.setLocation(panelx, panely);
+ subjectpanel.setFocusable(true);
+ contentPane.add(subjectpanel);
+ subjectpanel.setVisible(true);
+ }
+ else if(source==studentsbutton)
+ {
+ activeButton(studentsbutton);
+ studentpanel=new StudentPanel(this);
+ studentpanel.setLocation(panelx,panely);
+ studentpanel.setVisible(true);
+ studentpanel.setFocusable(true);
+ contentPane.add(studentpanel);
+ }
+ else if(source==faculitiesbutton)
+ {
+
+ activeButton(faculitiesbutton);
+ facultypanel=new FacultyPanel(this);
+ facultypanel.setLocation(panelx,panely);
+ facultypanel.setVisible(true);
+ facultypanel.setFocusable(true);
+ contentPane.add(facultypanel);
+
+ }
+ else if(source==assignedsubjectbutton)
+ {
+ activeButton(assignedsubjectbutton);
+ assignsubjectpanel=new AssignSubjectPanel(this);
+ assignsubjectpanel.setLocation(panelx,panely);
+ assignsubjectpanel.setVisible(true);
+ assignsubjectpanel.setFocusable(true);
+ contentPane.add(assignsubjectpanel);
+
+ }
+
+ else if(source==marksheetbutton)
+ {
+ activeButton(marksheetbutton);
+ marksheetpanel=new MarkSheetPanel(this,s);
+ marksheetpanel.setVisible(true);
+ marksheetpanelscroll=new JScrollPane(marksheetpanel,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ marksheetpanelscroll.getVerticalScrollBar().setUnitIncrement(16);
+ marksheetpanelscroll.setBounds(panelx,panely, 1116, 705);
+ contentPane.add(marksheetpanelscroll);
+ marksheetpanelscroll.setVisible(true);
+
+ }
+
+ else if(source==attandancereportbutton)
+ {
+ activeButton(attandancereportbutton);
+ attandancereportpanel=new AttandanceReportPanel(this);
+ attandancereportpanel.setVisible(true);
+ attandancereportpanelscroll=new JScrollPane(attandancereportpanel,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ attandancereportpanelscroll.setBounds(panelx, panely, 1116, 705);
+ attandancereportpanelscroll.setVisible(true);
+ attandancereportpanelscroll.setName("Attadance Report Panel Scroll");
+ attandancereportpanelscroll.getVerticalScrollBar().setUnitIncrement(16);
+ contentPane.add(attandancereportpanelscroll);
+ for(Component c:attandancereportpanelscroll.getComponents())
+ {
+ c.setBackground(Color.white);
+ }
+ }
+ else if(source==chatbutton)
+ {
+ activeButton(chatbutton);
+ chatmainpanel=new ChatMainPanel(this);
+ chatmainpanel.setLocation(this.panelx, this.panely);
+ chatmainpanel.setVisible(true);
+ contentPane.add(chatmainpanel);
+
+ }
+ else if(source==searchbutton)
+ {
+ activeButton(searchbutton);
+ searchpanel=new SearchPanel(this);
+ searchpanel.setLocation(this.panelx, this.panely);
+ searchpanel.setVisible(true);
+ contentPane.add(searchpanel);
+
+ }
+ else if(source==notificationbutton)
+ {
+ activeButton(notificationbutton);
+ if(totalnewnotification!=null && totalnewnotification.isVisible())
+ {
+ totalnewnotification.setVisible(false);
+ }
+ notificationpanel=new NotificationPanel(this);
+ notificationpanel.setLocation(panelx,panely);
+ notificationpanel.setVisible(true);
+ notificationpanel.setFocusable(true);
+ contentPane.add(notificationpanel);
+ }
+ else if(source==myprofilebutton)
+ {
+ activeButton(myprofilebutton);
+ viewstudentpanel=new ViewStudentPanel(s,this);
+ viewstudentpanel.setLocation(panelx,0);
+ viewstudentpanel.setVisible(true);
+ viewstudentpanel.setFocusable(true);
+
+ contentPane.add(viewstudentpanel);
+ }
+ else if(source==contactusbutton)
+ {
+ activeButton(contactusbutton);
+ adminprofilepanel=new AdminProfilePanel();
+ adminprofilepanel.setLocation(panelx,panely);
+ adminprofilepanel.setVisible(true);
+ adminprofilepanel.setFocusable(true);
+ contentPane.add(adminprofilepanel);
+ }
+ else if(source==exitbutton)
+ {
+ int result=JOptionPane.showConfirmDialog(null,"Do you want to exit this application ?","Exit",JOptionPane.INFORMATION_MESSAGE);
+ if(result==JOptionPane.YES_OPTION)
+ {
+ try {
+ s.setActiveStatus(false);
+ timer.stop();
+ new StudentData().setActiveStatus(false, s.getUserId());
+ DataBaseConnection.closeConnection();
+
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ this.disablepanel();
+ System.exit(0);
+ }
+ }
+ else if(source==logoutbutton)
+ {
+ int result=JOptionPane.showConfirmDialog(null,"Do you want to logout this application ?","Logout",JOptionPane.INFORMATION_MESSAGE);
+ if(result==JOptionPane.YES_OPTION)
+ {
+ s.setActiveStatus(false);
+ timer.stop();
+ new StudentData().setActiveStatus(false, s.getUserId());
+ LoginPageFrame loginpageframe=new LoginPageFrame();
+ loginpageframe.setVisible(true);
+ loginpageframe.setLocationRelativeTo(null);
+ this.disablepanel();
+ this.dispose();
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/src/collegeapplication/student/StudentPanel.java b/src/collegeapplication/student/StudentPanel.java
new file mode 100644
index 0000000..4aac71a
--- /dev/null
+++ b/src/collegeapplication/student/StudentPanel.java
@@ -0,0 +1,365 @@
+package collegeapplication.student;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.sql.ResultSet;
+
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFormattedTextField;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JSpinner;
+import javax.swing.JTable;
+import javax.swing.SpinnerNumberModel;
+import javax.swing.SwingConstants;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.LineBorder;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.text.DefaultFormatter;
+
+import collegeapplication.admin.AdminMain;
+import collegeapplication.common.PhotoViewPanel;
+import collegeapplication.faculty.FacultyMain;
+import net.proteanit.sql.DbUtils;
+
+/*
+ * Title : StudentPanel.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : Displaying all student details in table/photo view
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+@SuppressWarnings("serial")
+public class StudentPanel extends JPanel implements ActionListener
+{
+ public JTable table;
+ private JButton viewstudentbutton,addstudentbutton;
+ public AdminMain am;
+ public FacultyMain fm;
+ public StudentMain sm;
+ public JButton viewbutton;
+ public JScrollPane tableviewscroll;
+ public JScrollPane photoviewscrollpane;
+ private JSpinner maxphotospinner;
+ private JLabel maxphotolabel;
+ private int maxphoto=5;
+ private String condition="";
+ private JLabel studentslabel;
+ private JButton backbutton;
+ private JPanel panel;
+ /**
+ * Create the panel.
+ */
+ public StudentPanel(AdminMain am)
+ {
+ this();
+ this.am=am;
+ }
+ public StudentPanel(FacultyMain fm)
+ {
+ this();
+ this.fm=fm;
+ condition=" and s.courcecode='"+fm.f.getCourceCode()+"' and s.semoryear="+fm.f.getSemorYear()+" ";
+ this.createtablemodel();
+ this.addstudentbutton.setVisible(false);
+ this.viewstudentbutton.setVisible(false);
+ this.viewbutton.setLocation(addstudentbutton.getX(), addstudentbutton.getY());
+ }
+ public StudentPanel(FacultyMain fm,JComponent lastpanel)
+ {
+ this();
+ this.fm=fm;
+ condition=" and s.courcecode='"+fm.f.getCourceCode()+"' and s.semoryear="+fm.f.getSemorYear()+" ";
+ this.createtablemodel();
+ this.addstudentbutton.setVisible(false);
+ this.viewstudentbutton.setVisible(false);
+ this.viewbutton.setLocation(addstudentbutton.getX(), addstudentbutton.getY());
+ backbutton = new JButton("Back");
+ backbutton.setContentAreaFilled(false);
+ backbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ backbutton.setIcon(new ImageIcon(".\\assets\\back.png"));
+ backbutton.setFocusable(false);
+ backbutton.setForeground(Color.WHITE);
+ backbutton.setFont(new Font("Segoe UI", Font.BOLD, 16));
+ backbutton.setBackground(new Color(32, 178, 170));
+ backbutton.setBounds(10, 141, 88, 36);
+ panel.add(backbutton);
+
+ backbutton.addActionListener(e->
+ {
+ fm.studentpanel.setVisible(false);
+ lastpanel.setVisible(true);
+ });
+ }
+ public StudentPanel(StudentMain sm)
+ {
+ this();
+ this.sm=sm;
+ condition=" and s.courcecode='"+sm.s.getCourceCode()+"' and s.semoryear="+sm.s.getSemorYear()+" "+" and userid!='"+sm.s.getUserId()+"'";
+ this.createtablemodel();
+ this.addstudentbutton.setVisible(false);
+ this.viewstudentbutton.setVisible(false);
+ this.viewbutton.setLocation(addstudentbutton.getX(), addstudentbutton.getY());
+ studentslabel.setText("Classmates");
+ }
+ private StudentPanel()
+ {
+ this.setName("Student Panel");
+ setBackground(new Color(255, 255, 255));
+ this.setSize(1116, 705);
+ setLayout(null);
+
+ tableviewscroll = new JScrollPane();
+ tableviewscroll.setBorder(new EmptyBorder(0, 0, 0, 0));
+ tableviewscroll.setBounds(10, 194, 1096, 500);
+ for(Component c : tableviewscroll.getComponents())
+ {
+ c.setBackground(Color.white);
+ }
+ add(tableviewscroll);
+
+
+ table = new JTable();
+ table.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ table.getTableHeader().setBackground(new Color(32,178,170));
+ table.getTableHeader().setForeground(Color.white);
+ table.setSelectionBackground(new Color(240, 255, 255));
+ table.getTableHeader().setFont(new Font("Arial",Font.BOLD,20));
+ table.setFont(new Font("Segoe UI",Font.PLAIN,20));
+ table.getTableHeader().setPreferredSize(new Dimension(50,40));
+ table.setFocusable(false);
+ table.setDragEnabled(false);
+ table.setRowHeight(40);
+ createtablemodel();
+ table.setDefaultEditor(Object.class, null);
+ table.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ table.setGridColor(Color.LIGHT_GRAY);
+ table.getTableHeader().setReorderingAllowed(false);
+ tableviewscroll.setViewportView(table);
+ table.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ if(e.getClickCount()>1&&e.getButton()==MouseEvent.BUTTON1)
+ {
+
+ JTable t=(JTable) e.getSource();
+ int row=t.getSelectedRow();
+ String courcecode=table.getValueAt(row,0)+"";
+ String strsem=table.getValueAt(row, 4)+"";
+ int sem=Integer.parseInt(strsem.substring(strsem.indexOf('-')+1));
+ String strroll=table.getValueAt(row, 1)+"";
+ long rollnumber=Long.parseLong(strroll);
+ Student s=new StudentData().getStudentDetails(courcecode,sem,rollnumber);
+
+ if(am!=null)
+ {
+ am.viewstudentpanel=new ViewStudentPanel(s,am,am.studentpanel);
+ am.viewstudentpanel.setVisible(true);
+ am.studentpanel.setVisible(false);
+ am.viewstudentpanel.setLocation(am.panelx,0);
+ am.viewstudentpanel.setVisible(true);
+ am.viewstudentpanel.setFocusable(true);
+ am.contentPane.add(am.viewstudentpanel);
+ }
+ else if(fm!=null)
+ {
+ fm.viewstudentpanel=new ViewStudentPanel(s,fm,fm.studentpanel);
+ fm.viewstudentpanel.setVisible(true);
+ fm.studentpanel.setVisible(false);
+ fm.viewstudentpanel.setLocation(fm.panelx,0);
+ fm.viewstudentpanel.setVisible(true);
+ fm.viewstudentpanel.setFocusable(true);
+ fm.contentPane.add(fm.viewstudentpanel);
+ }
+ else if(sm!=null)
+ {
+ sm.viewstudentpanel=new ViewStudentPanel(s,sm,sm.studentpanel);
+ sm.viewstudentpanel.setVisible(true);
+ sm.studentpanel.setVisible(false);
+ sm.viewstudentpanel.setLocation(sm.panelx,0);
+ sm.viewstudentpanel.setVisible(true);
+ sm.viewstudentpanel.setFocusable(true);
+ sm.contentPane.add(sm.viewstudentpanel);
+ }
+ }
+
+ }
+ });
+
+ panel = new JPanel();
+ panel.setBackground(new Color(32, 178, 170));
+ panel.setBounds(10, 0, 1096, 183);
+ add(panel);
+ panel.setLayout(null);
+
+ studentslabel = new JLabel("All Students");
+ studentslabel.setIcon(null);
+ studentslabel.setBounds(10, 65, 224, 44);
+ panel.add(studentslabel);
+ studentslabel.setBackground(new Color(32, 178, 170));
+ studentslabel.setHorizontalAlignment(SwingConstants.LEFT);
+ studentslabel.setForeground(Color.WHITE);
+ studentslabel.setFont(new Font("Segoe UI", Font.BOLD, 30));
+ studentslabel.setOpaque(true);
+
+ viewstudentbutton = new JButton("View Student");
+ viewstudentbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ viewstudentbutton.setBounds(769, 139, 153, 33);
+ panel.add(viewstudentbutton);
+ viewstudentbutton.setFocusable(false);
+ viewstudentbutton.setForeground(new Color(0, 128, 128));
+ viewstudentbutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ viewstudentbutton.setBackground(new Color(255, 255, 255));
+ viewstudentbutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ viewstudentbutton.addActionListener(this);
+
+ addstudentbutton = new JButton("Add Student");
+ addstudentbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ addstudentbutton.setBounds(932, 139, 153, 33);
+ panel.add(addstudentbutton);
+ addstudentbutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ addstudentbutton.setFocusable(false);
+ addstudentbutton.setForeground(new Color(0, 128, 128));
+ addstudentbutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ addstudentbutton.setBackground(new Color(255, 255, 255));
+
+ viewbutton = new JButton("Photo View");
+ viewbutton.addActionListener(this);
+ viewbutton.setForeground(new Color(0, 128, 128));
+ viewbutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ viewbutton.setFocusable(false);
+ viewbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ viewbutton.setBackground(Color.WHITE);
+ viewbutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ viewbutton.setBounds(606, 139, 153, 33);
+ panel.add(viewbutton);
+ maxphotospinner = new JSpinner();
+
+ maxphotospinner.setModel(new SpinnerNumberModel(maxphoto, 1, 12, 1));
+ maxphotospinner.setFont(new Font("Tahoma", Font.PLAIN, 17));
+ maxphotospinner.setBounds(1009, 98, 76, 30);
+ maxphotospinner.setVisible(false);
+ JComponent c=maxphotospinner.getEditor();
+ JFormattedTextField tf=(JFormattedTextField)c.getComponent(0);
+ tf.setFocusable(false);
+ DefaultFormatter f=(DefaultFormatter) tf.getFormatter();
+ f.setCommitsOnValidEdit(true);
+ maxphotospinner.addChangeListener(new ChangeListener()
+ {
+
+ @Override
+ public void stateChanged(ChangeEvent arg0) {
+ // TODO Auto-generated method stub
+ maxphoto=(int) maxphotospinner.getValue();
+
+ createphotopanel();
+ }
+
+
+ });
+
+ panel.add(maxphotospinner);
+
+ maxphotolabel = new JLabel("Max Photos in Row");
+ maxphotolabel.setHorizontalAlignment(SwingConstants.RIGHT);
+ maxphotolabel.setFont(new Font("Segoe UI", Font.BOLD, 17));
+ maxphotolabel.setForeground(new Color(255, 255, 255));
+ maxphotolabel.setBounds(797, 98, 193, 30);
+ maxphotolabel.setVisible(false);
+ panel.add(maxphotolabel);
+ addstudentbutton.addActionListener(this);
+ }
+
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO Auto-generated method stub
+ if(e.getSource()==viewstudentbutton)
+ {
+ ViewStudentDialog vs=new ViewStudentDialog(am);
+ vs.setLocationRelativeTo(null);
+ vs.setVisible(true);
+ }
+ if(e.getSource()==addstudentbutton)
+ {
+ AddStudentDialog sd=new AddStudentDialog(table,this);
+ sd.setLocationRelativeTo(null);
+ sd.setVisible(true);
+
+
+ }
+ if(e.getSource()==viewbutton && viewbutton.getText().equals("Photo View"))
+ {
+
+
+ createphotopanel();
+
+
+ }
+ else if(e.getSource()==viewbutton && viewbutton.getText().equals("Table View"))
+ {
+ if(photoviewscrollpane!=null)
+ {
+ photoviewscrollpane.setVisible(false);
+ }
+ createtablemodel();
+ tableviewscroll.setVisible(true);
+ viewbutton.setText("Photo View");
+
+ }
+ if(photoviewscrollpane!=null && photoviewscrollpane.isVisible())
+ {
+ maxphotolabel.setVisible(true);
+ maxphotospinner.setVisible(true);
+ }
+ else
+ {
+ maxphotolabel.setVisible(false);
+ maxphotospinner.setVisible(false);
+ }
+ }
+ public void createphotopanel()
+ {
+ if(this.photoviewscrollpane!=null)
+ {
+ this.photoviewscrollpane.setVisible(false);
+ }
+ this.tableviewscroll.setVisible(false);
+ PhotoViewPanel photoviewpanel=new PhotoViewPanel(this,maxphoto);
+ photoviewpanel.setVisible(true);
+ this.photoviewscrollpane=new JScrollPane(photoviewpanel,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ this.photoviewscrollpane.getVerticalScrollBar().setUnitIncrement(16);
+ this.photoviewscrollpane.setBounds(0, 189, 1105, 500);
+ this.photoviewscrollpane.setVisible(true);
+ this.add(photoviewscrollpane);
+ this.photoviewscrollpane.setBorder(new EmptyBorder(0,0,0,0));
+ viewbutton.setText("Table View");
+ }
+ public void createtablemodel()
+ {
+ ResultSet rs=new StudentData().getStudentinfo(condition);
+ if(rs!=null)
+ {
+ table.setModel(DbUtils.resultSetToTableModel(rs));
+ }
+ table.getColumnModel().getColumn(0).setMaxWidth(150);
+ table.getColumnModel().getColumn(1).setMaxWidth(200);
+ table.getColumnModel().getColumn(2).setMaxWidth(300);
+ table.getColumnModel().getColumn(3).setMaxWidth(300);
+ table.getColumnModel().getColumn(4).setMaxWidth(150);
+ table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
+ }
+}
diff --git a/src/collegeapplication/student/ViewStudentDialog.java b/src/collegeapplication/student/ViewStudentDialog.java
new file mode 100644
index 0000000..b58376b
--- /dev/null
+++ b/src/collegeapplication/student/ViewStudentDialog.java
@@ -0,0 +1,213 @@
+package collegeapplication.student;
+
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Dialog;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingConstants;
+import javax.swing.border.MatteBorder;
+
+import collegeapplication.admin.AdminMain;
+import collegeapplication.cource.CourceData;
+
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+
+/*
+ * Title : ViewStudentDialog.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : Selecting student for finding more details
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+@SuppressWarnings("serial")
+public class ViewStudentDialog extends JDialog implements ActionListener
+{
+
+ private JComboBox courcenamecombo,semoryearcombo,rollnumbercombo;
+ private JButton viewdetails;
+ private AdminMain am;
+ private JLabel Errorlabel;
+ private static ViewStudentDialog dialog;
+ /**
+ * Launch the application.
+ */
+ public static void main(String[] args) {
+ try {
+ dialog = new ViewStudentDialog(null);
+ dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+ dialog.setVisible(true);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Create the dialog.
+ */
+ public ViewStudentDialog(AdminMain am) {
+ super(dialog,"",Dialog.ModalityType.APPLICATION_MODAL);
+
+ this.am=am;
+ setResizable(false);
+ getContentPane().setBackground(Color.WHITE);
+ setSize(520, 484);
+ getContentPane().setLayout(null);
+ JLabel headerlabel = new JLabel("View Student Details");
+ headerlabel.setFont(new Font("Segoe UI", Font.PLAIN, 15));
+ headerlabel.setHorizontalAlignment(SwingConstants.CENTER);
+ headerlabel.setBounds(0, 0, 514, 53);
+ getContentPane().add(headerlabel);
+ headerlabel.setBackground(new Color(32, 178, 170));
+ headerlabel.setOpaque(true);
+ headerlabel.setForeground(new Color(255, 255, 255));
+ headerlabel.setFont(new Font("Arial", Font.BOLD, 23));
+ headerlabel.setBorder(new MatteBorder(0, 0, 1, 0, (Color) Color.LIGHT_GRAY));
+
+ courcenamecombo = new JComboBox(new CourceData().getCourceName());
+ courcenamecombo.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+
+ courcenamecombo.setFocusable(false);
+ courcenamecombo.setBackground(Color.WHITE);
+ courcenamecombo.setBounds(170, 98, 320, 43);
+ courcenamecombo.addActionListener(this);
+ getContentPane().add(courcenamecombo);
+
+ semoryearcombo = new JComboBox();
+ semoryearcombo.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ semoryearcombo.setFocusable(false);
+ semoryearcombo.setBackground(Color.WHITE);
+ semoryearcombo.setBounds(170, 191, 320, 43);
+ semoryearcombo.addActionListener(this);
+ getContentPane().add(semoryearcombo);
+
+ rollnumbercombo = new JComboBox();
+ rollnumbercombo.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ rollnumbercombo.setFocusable(false);
+ rollnumbercombo.setBackground(Color.WHITE);
+ rollnumbercombo.setBounds(170, 286, 320, 43);
+ rollnumbercombo.addActionListener(this);
+ getContentPane().add(rollnumbercombo);
+
+ JPanel panel = new JPanel();
+ panel.setBackground(Color.WHITE);
+ panel.setBorder(new MatteBorder(1, 0, 0, 0, (Color) Color.GRAY));
+ panel.setBounds(0, 402, 514, 53);
+ getContentPane().add(panel);
+ panel.setLayout(null);
+
+ viewdetails = new JButton("View Details");
+ viewdetails.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ viewdetails.setFocusable(false);
+ viewdetails.setFont(new Font("Segoe UI", Font.BOLD, 14));
+ viewdetails.setForeground(new Color(255, 255, 255));
+ viewdetails.setBackground(new Color(32, 178, 170));
+ viewdetails.addActionListener(this);
+ viewdetails.setBounds(351, 11, 139, 33);
+ panel.add(viewdetails);
+
+ JLabel lblCource = new JLabel("Cource :");
+ lblCource.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblCource.setFont(new Font("Microsoft YaHei Light", Font.BOLD, 18));
+ lblCource.setBounds(24, 98, 136, 43);
+ getContentPane().add(lblCource);
+
+ JLabel lblSemyear = new JLabel("Sem/Year :");
+ lblSemyear.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblSemyear.setFont(new Font("Microsoft YaHei Light", Font.BOLD, 18));
+ lblSemyear.setBounds(24, 191, 136, 43);
+ getContentPane().add(lblSemyear);
+
+ JLabel lblRollNumber = new JLabel("Roll no :");
+ lblRollNumber.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblRollNumber.setFont(new Font("Microsoft YaHei Light", Font.BOLD, 18));
+ lblRollNumber.setBounds(10, 286, 150, 43);
+ getContentPane().add(lblRollNumber);
+
+ Errorlabel = new JLabel("This is required question !");
+ Errorlabel.setForeground(new Color(255, 0, 0));
+ Errorlabel.setFont(new Font("Calibri", Font.PLAIN, 16));
+ Errorlabel.setBounds(21, 127, 250, 17);
+ Errorlabel.setVisible(false);
+ getContentPane().add(Errorlabel);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO Auto-generated method stub
+
+ if(e.getSource()==viewdetails)
+ {
+ if(courcenamecombo.getSelectedIndex()==0)
+ {
+ showerror(courcenamecombo);
+ }
+ else if(semoryearcombo.getSelectedIndex()==0)
+ {
+ showerror(semoryearcombo);
+ }
+ else if(rollnumbercombo.getSelectedIndex()==0)
+ {
+ showerror(rollnumbercombo);
+ }
+ else
+ {
+ String Courcecode=new CourceData().getCourcecode(courcenamecombo.getSelectedItem()+"");
+ int sem=semoryearcombo.getSelectedIndex();
+ long rollnumber=Long.parseLong(rollnumbercombo.getSelectedItem()+"");
+ Student s=new StudentData().getStudentDetails(Courcecode, sem, rollnumber);
+
+ am.viewstudentpanel=new ViewStudentPanel(s,am,am.studentpanel);
+ am.viewstudentpanel.setVisible(true);
+ am.studentpanel.setVisible(false);
+ am.viewstudentpanel.setLocation(238,0);
+ am.viewstudentpanel.setVisible(true);
+ am.viewstudentpanel.setFocusable(true);
+ am.contentPane.add(am.viewstudentpanel);
+
+ this.dispose();
+ }
+ }
+
+ if(e.getSource()==courcenamecombo)
+ {
+
+
+ if(courcenamecombo.getSelectedIndex()==0)
+ {
+ semoryearcombo.setModel(new DefaultComboBoxModel(new String[] {""}));
+ }
+ else
+ {
+ String cource=(String) courcenamecombo.getSelectedItem();
+
+ semoryearcombo.setModel(new DefaultComboBoxModel(new CourceData().getSemorYear(cource)));
+ }
+
+ }
+ if(e.getSource()==semoryearcombo)
+ {
+ if(semoryearcombo.getSelectedIndex()>0)
+ {
+ String courcecode=new CourceData().getCourcecode(courcenamecombo.getSelectedItem()+"");
+ int sem=semoryearcombo.getSelectedIndex();
+ rollnumbercombo.setModel(new DefaultComboBoxModel(new StudentData().getRollNumber(courcecode, sem)));
+ }
+ }
+
+ }
+ public void showerror(JComponent tf)
+ {
+ Errorlabel.setVisible(true);
+ Errorlabel.setBounds(tf.getX(), tf.getY()+tf.getHeight()-5, 250,26);
+ }
+}
diff --git a/src/collegeapplication/student/ViewStudentPanel.java b/src/collegeapplication/student/ViewStudentPanel.java
new file mode 100644
index 0000000..fb14a0c
--- /dev/null
+++ b/src/collegeapplication/student/ViewStudentPanel.java
@@ -0,0 +1,617 @@
+package collegeapplication.student;
+
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.SwingConstants;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.LineBorder;
+
+import collegeapplication.admin.AdminMain;
+import collegeapplication.common.ChangePasswordDialog;
+import collegeapplication.cource.CourceData;
+import collegeapplication.faculty.FacultyMain;
+
+/*
+ * Title : ViewStudentPanel.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : Displaying all the details of student
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+@SuppressWarnings("serial")
+public class ViewStudentPanel extends JPanel {
+
+ private JButton editdetailsbutton;
+ public JComponent lastpanel;
+ AdminMain am;
+ FacultyMain fm;
+ StudentMain sm;
+ private JButton backbutton;
+ private JButton marksheetbutton;
+ private JLabel lblLastLogin;
+
+ /**
+ * Create the panel.
+ * @wbp.parser.constructor
+*/
+ private ViewStudentPanel(Student s)
+ {
+
+ setBackground(new Color(255, 255, 255));
+ this.setSize(1116, 705);
+ setLayout(null);
+
+ JPanel panel = new JPanel();
+ panel.setBackground(new Color(32, 178, 170));
+ panel.setBounds(10, 0, 1095, 188);
+ add(panel);
+ panel.setLayout(null);
+
+ JLabel lblDisplayingStudentDetails = new JLabel(s.getFullName()+" ("+s.getUserId()+")");
+ lblDisplayingStudentDetails.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblDisplayingStudentDetails.setForeground(new Color(255, 255, 255));
+ lblDisplayingStudentDetails.setFont(new Font("Segoe UI", Font.BOLD, 30));
+ lblDisplayingStudentDetails.setBounds(0, 11, 1067, 44);
+ panel.add(lblDisplayingStudentDetails);
+
+ editdetailsbutton = new JButton("Edit Details");
+ editdetailsbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ editdetailsbutton.setFocusable(false);
+ editdetailsbutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ editdetailsbutton.setForeground(new Color(0, 139, 139));
+ editdetailsbutton.setBackground(new Color(255, 255, 255));
+ editdetailsbutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+
+ editdetailsbutton.setBounds(932, 141, 140, 35);
+ panel.add(editdetailsbutton);
+
+ marksheetbutton = new JButton("Marksheet");
+ marksheetbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ marksheetbutton.setFocusable(false);
+
+
+ marksheetbutton.setForeground(new Color(0, 139, 139));
+ marksheetbutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ marksheetbutton.setBackground(new Color(255, 255, 255));
+ marksheetbutton.setBounds(782, 141, 140, 35);
+ marksheetbutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ panel.add(marksheetbutton);
+
+ backbutton = new JButton("Back");
+ backbutton.setContentAreaFilled(false);
+ backbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+
+ backbutton.setIcon(new ImageIcon(".\\assets\\back.png"));
+ backbutton.setFocusable(false);
+ backbutton.setForeground(Color.WHITE);
+ backbutton.setFont(new Font("Segoe UI", Font.BOLD, 16));
+ backbutton.setBackground(new Color(32, 178, 170));
+ backbutton.setBounds(10, 141, 88, 36);
+ panel.add(backbutton);
+
+ lblLastLogin = new JLabel("Last Login ");
+ if(s.getLastLogin()==null||s.getLastLogin().isEmpty())
+ {
+ lblLastLogin.setText("Last Login : No Login");
+ }
+
+ else
+ {
+ lblLastLogin.setText("Last Login : "+s.getLastLogin());
+ }
+ lblLastLogin.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblLastLogin.setForeground(Color.WHITE);
+ lblLastLogin.setFont(new Font("Tahoma", Font.BOLD, 15));
+ lblLastLogin.setBounds(710, 58, 357, 19);
+ panel.add(lblLastLogin);
+
+ JLabel lblStudentDetails = new JLabel("Student Details");
+ lblStudentDetails.setHorizontalAlignment(SwingConstants.LEFT);
+ lblStudentDetails.setForeground(Color.WHITE);
+ lblStudentDetails.setFont(new Font("Segoe UI", Font.BOLD, 30));
+ lblStudentDetails.setBounds(10, 65, 415, 44);
+ panel.add(lblStudentDetails);
+
+ JLabel lblRollNo = new JLabel("Roll no ");
+ lblRollNo.setBorder(new LineBorder(new Color(192, 192, 192)));
+ lblRollNo.setBackground(new Color(255, 255, 255));
+ lblRollNo.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ lblRollNo.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblRollNo.setOpaque(true);
+ lblRollNo.setBounds(309, 66+150, 274, 48);
+ add(lblRollNo);
+
+ JLabel lblStudentName = new JLabel("Student Name ");
+ lblStudentName.setOpaque(true);
+ lblStudentName.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblStudentName.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ lblStudentName.setBorder(new LineBorder(new Color(192, 192, 192)));
+ lblStudentName.setBackground(Color.WHITE);
+ lblStudentName.setBounds(309, 113+150, 274, 48);
+ add(lblStudentName);
+
+ JLabel lblAddress = new JLabel("Address ");
+ lblAddress.setOpaque(true);
+ lblAddress.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblAddress.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ lblAddress.setBorder(new LineBorder(new Color(192, 192, 192)));
+ lblAddress.setBackground(Color.WHITE);
+ lblAddress.setBounds(309, 160+150, 274, 48);
+ add(lblAddress);
+
+ JLabel lblEmailId = new JLabel("Email ID ");
+ lblEmailId.setOpaque(true);
+ lblEmailId.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblEmailId.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ lblEmailId.setBorder(new LineBorder(new Color(192, 192, 192)));
+ lblEmailId.setBackground(Color.WHITE);
+ lblEmailId.setBounds(309, 207+150, 274, 48);
+ add(lblEmailId);
+
+ JLabel lblDateOfBirth = new JLabel("Date Of Birth ");
+ lblDateOfBirth.setOpaque(true);
+ lblDateOfBirth.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblDateOfBirth.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ lblDateOfBirth.setBorder(new LineBorder(new Color(192, 192, 192)));
+ lblDateOfBirth.setBackground(Color.WHITE);
+ lblDateOfBirth.setBounds(309, 254+150, 274, 48);
+ add(lblDateOfBirth);
+
+ JLabel lblContactNumber = new JLabel("Contact Number ");
+ lblContactNumber.setOpaque(true);
+ lblContactNumber.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblContactNumber.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ lblContactNumber.setBorder(new LineBorder(new Color(192, 192, 192)));
+ lblContactNumber.setBackground(Color.WHITE);
+ lblContactNumber.setBounds(309, 300+150, 274, 48);
+ add(lblContactNumber);
+
+ JLabel lblCource = new JLabel("Cource ");
+ lblCource.setOpaque(true);
+ lblCource.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblCource.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ lblCource.setBorder(new LineBorder(new Color(192, 192, 192)));
+ lblCource.setBackground(Color.WHITE);
+ lblCource.setBounds(20, 359+150, 291, 48);
+ add(lblCource);
+
+ JLabel lblFatherName = new JLabel("Father Name ");
+ lblFatherName.setOpaque(true);
+ lblFatherName.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblFatherName.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ lblFatherName.setBorder(new LineBorder(new Color(192, 192, 192)));
+ lblFatherName.setBackground(Color.WHITE);
+ lblFatherName.setBounds(20, 405+150, 291, 48);
+ add(lblFatherName);
+
+ JLabel lblFatherOccupation = new JLabel("Father Occupation ");
+ lblFatherOccupation.setOpaque(true);
+ lblFatherOccupation.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblFatherOccupation.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ lblFatherOccupation.setBorder(new LineBorder(new Color(192, 192, 192)));
+ lblFatherOccupation.setBackground(Color.WHITE);
+ lblFatherOccupation.setBounds(582, 405+150, 239, 48);
+ add(lblFatherOccupation);
+
+ JLabel lblMotherName = new JLabel("Mother Name ");
+ lblMotherName.setOpaque(true);
+ lblMotherName.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblMotherName.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ lblMotherName.setBorder(new LineBorder(new Color(192, 192, 192)));
+ lblMotherName.setBackground(Color.WHITE);
+ lblMotherName.setBounds(20, 452+150, 291, 48);
+ add(lblMotherName);
+
+ JLabel lblMotherOccupation = new JLabel("Mother Occupation ");
+ lblMotherOccupation.setOpaque(true);
+ lblMotherOccupation.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblMotherOccupation.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ lblMotherOccupation.setBorder(new LineBorder(new Color(192, 192, 192)));
+ lblMotherOccupation.setBackground(Color.WHITE);
+ lblMotherOccupation.setBounds(582, 452+150, 239, 48);
+ add(lblMotherOccupation);
+
+ JLabel rollnumberlabel = new JLabel(" "+s.getRollNumber());
+ rollnumberlabel.setOpaque(true);
+ rollnumberlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ rollnumberlabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ rollnumberlabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ rollnumberlabel.setBackground(Color.WHITE);
+ rollnumberlabel.setBounds(582, 66+150, 523, 48);
+ add(rollnumberlabel);
+
+ JLabel studentnamelabel = new JLabel(" "+s.getFullName());
+ studentnamelabel.setOpaque(true);
+ studentnamelabel.setHorizontalAlignment(SwingConstants.LEFT);
+ studentnamelabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ studentnamelabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ studentnamelabel.setBackground(Color.WHITE);
+ studentnamelabel.setBounds(582, 113+150, 523, 48);
+ add(studentnamelabel);
+
+ JLabel addresslabel = new JLabel(" "+s.getAddress());
+ addresslabel.setOpaque(true);
+ addresslabel.setHorizontalAlignment(SwingConstants.LEFT);
+ addresslabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ addresslabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ addresslabel.setBackground(Color.WHITE);
+ addresslabel.setBounds(582, 160+150, 523, 48);
+ add(addresslabel);
+
+ JLabel emailidlabel = new JLabel(" "+s.getEmailId());
+ emailidlabel.setOpaque(true);
+ emailidlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ emailidlabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ emailidlabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ emailidlabel.setBackground(Color.WHITE);
+ emailidlabel.setBounds(582, 207+150, 523, 48);
+ add(emailidlabel);
+
+ JLabel dateofbirthlabel = new JLabel(" "+s.getBirthDate());
+ dateofbirthlabel.setOpaque(true);
+ dateofbirthlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ dateofbirthlabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ dateofbirthlabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ dateofbirthlabel.setBackground(Color.WHITE);
+ dateofbirthlabel.setBounds(582, 254+150, 523, 48);
+ add(dateofbirthlabel);
+
+ JLabel contactnumberlabel = new JLabel(" "+s.getContactNumber());
+ contactnumberlabel.setOpaque(true);
+ contactnumberlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ contactnumberlabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ contactnumberlabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ contactnumberlabel.setBackground(Color.WHITE);
+ contactnumberlabel.setBounds(582, 300+150, 523, 48);
+ add(contactnumberlabel);
+
+ JLabel courcenamelabel = new JLabel(" "+new CourceData().getcourcename(s.getCourceCode()));
+ courcenamelabel.setOpaque(true);
+ courcenamelabel.setHorizontalAlignment(SwingConstants.LEFT);
+ courcenamelabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ courcenamelabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ courcenamelabel.setBackground(Color.WHITE);
+ courcenamelabel.setBounds(309, 359+150, 274, 48);
+ add(courcenamelabel);
+
+ JLabel fathernamelabel = new JLabel(" "+s.getFatherName());
+ fathernamelabel.setOpaque(true);
+ fathernamelabel.setHorizontalAlignment(SwingConstants.LEFT);
+ fathernamelabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ fathernamelabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ fathernamelabel.setBackground(Color.WHITE);
+ fathernamelabel.setBounds(309, 405+150, 274, 48);
+ add(fathernamelabel);
+
+ JLabel fatheroccupationlabel = new JLabel(" "+s.getFatherOccupation());
+ fatheroccupationlabel.setOpaque(true);
+ fatheroccupationlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ fatheroccupationlabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ fatheroccupationlabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ fatheroccupationlabel.setBackground(Color.WHITE);
+ fatheroccupationlabel.setBounds(820, 405+150, 285, 48);
+ add(fatheroccupationlabel);
+
+ JLabel mothernamelabel = new JLabel(" "+s.getMotherName());
+ mothernamelabel.setOpaque(true);
+ mothernamelabel.setHorizontalAlignment(SwingConstants.LEFT);
+ mothernamelabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ mothernamelabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ mothernamelabel.setBackground(Color.WHITE);
+ mothernamelabel.setBounds(309, 452+150, 274, 48);
+ add(mothernamelabel);
+
+ JLabel motheroccupationlabel = new JLabel(" "+s.getMotherOccupation());
+ motheroccupationlabel.setOpaque(true);
+ motheroccupationlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ motheroccupationlabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ motheroccupationlabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ motheroccupationlabel.setBackground(Color.WHITE);
+ motheroccupationlabel.setBounds(820, 452+150, 285, 48);
+ add(motheroccupationlabel);
+
+ JLabel profilepiclabel = new JLabel();
+ profilepiclabel.setBounds(20, 66+150, 250, 270);
+ add(profilepiclabel);
+ profilepiclabel.setIcon(new ImageIcon(s.getProfilePic(250, 270)));
+ profilepiclabel.setBorder(new LineBorder(new Color(192, 192, 192), 2));
+ profilepiclabel.setOpaque(true);
+ profilepiclabel.setBackground(new Color(240, 248, 255));
+ profilepiclabel.setFont(new Font("Tahoma", Font.PLAIN, 16));
+ profilepiclabel.setHorizontalAlignment(SwingConstants.CENTER);
+
+ JLabel lblsemoryear = new JLabel("Semester/Year ");
+ lblsemoryear.setOpaque(true);
+ lblsemoryear.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblsemoryear.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ lblsemoryear.setBorder(new LineBorder(new Color(192, 192, 192)));
+ lblsemoryear.setBackground(Color.WHITE);
+ lblsemoryear.setBounds(582, 359 + 150, 239, 48);
+ add(lblsemoryear);
+
+ JLabel semoryearlabel = new JLabel(
+ " " + new CourceData().getsemoryear(s.getCourceCode()) + "-" + s.getSemorYear() + " " + " (" + s.getCourceCode() + ")");
+ semoryearlabel.setOpaque(true);
+ semoryearlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ semoryearlabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ semoryearlabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ semoryearlabel.setBackground(Color.WHITE);
+ semoryearlabel.setBounds(820, 359 + 150, 285, 48);
+ add(semoryearlabel);
+
+
+ }
+ public ViewStudentPanel(Student s,AdminMain am,JComponent lastpanel)
+ {
+ this(s);
+ this.am=am;
+ this.lastpanel=lastpanel;
+ JLabel lblAdmissionDate = new JLabel("Admission Date ");
+ lblAdmissionDate.setOpaque(true);
+ lblAdmissionDate.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblAdmissionDate.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ lblAdmissionDate.setBorder(new LineBorder(new Color(192, 192, 192)));
+ lblAdmissionDate.setBackground(Color.WHITE);
+ lblAdmissionDate.setBounds(20, 649, 291, 48);
+ add(lblAdmissionDate);
+
+ JLabel admissiondatelabel = new JLabel(" "+s.getAdmissionDate());
+ admissiondatelabel.setOpaque(true);
+ admissiondatelabel.setHorizontalAlignment(SwingConstants.LEFT);
+ admissiondatelabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ admissiondatelabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ admissiondatelabel.setBackground(Color.WHITE);
+ admissiondatelabel.setBounds(309, 649, 274, 48);
+ add(admissiondatelabel);
+
+ JLabel lblPassword = new JLabel("Password ");
+ lblPassword.setOpaque(true);
+ lblPassword.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblPassword.setFont(new Font("Segoe UI Historic", Font.PLAIN, 20));
+ lblPassword.setBorder(new LineBorder(new Color(192, 192, 192)));
+ lblPassword.setBackground(Color.WHITE);
+ lblPassword.setBounds(582, 649, 239, 48);
+ add(lblPassword);
+
+ JLabel passwordlabel = new JLabel(" "+s.getPassword());
+ passwordlabel.setOpaque(true);
+ passwordlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ passwordlabel.setFont(new Font("Segoe UI Historic", Font.BOLD, 20));
+ passwordlabel.setBorder(new LineBorder(new Color(192, 192, 192)));
+ passwordlabel.setBackground(Color.WHITE);
+ passwordlabel.setBounds(820, 649, 285, 48);
+ add(passwordlabel);
+
+ marksheetbutton.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ // TODO Auto-generated method stub
+
+ am.viewstudentpanel.setVisible(false);
+ am.marksheetpanel=new MarkSheetPanel(am,s);
+ am.marksheetpanel.setVisible(true);
+ am.marksheetpanelscroll=new JScrollPane(am.marksheetpanel,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ am.marksheetpanelscroll.getVerticalScrollBar().setUnitIncrement(16);
+ am.marksheetpanelscroll.setBounds(am.panelx, am.panely, 1116, 705);
+ am.contentPane.add(am.marksheetpanelscroll);
+ am.marksheetpanelscroll.setVisible(true);
+ }
+
+ }
+
+ );
+ backbutton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ am.viewstudentpanel.setVisible(false);
+ if(lastpanel.getName().equals("Student Panel"))
+ {
+ if(am.studentpanel.viewbutton.getText().equals("Photo View"))
+ {
+ am.studentpanel.createtablemodel();
+ }
+ else
+ {
+ am.studentpanel.createphotopanel();
+ }
+ am.studentpanel.setVisible(true);
+ }
+ else if(lastpanel.getName().equals("Attadance Report Panel Scroll"))
+ {
+ am.attandancereportpanel.createtablemodel();
+ am.attandancereportpanelscroll.setVisible(true);
+ }
+ else if(lastpanel.getName().equals("Marksheet Report Panel Scroll"))
+ {
+ am.marksheetreportpanel.createtablemodel();
+ am.marksheetreportpanelscroll.setVisible(true);
+ }
+ else if(lastpanel.getName().equals("Search Panel"))
+ {
+ am.searchpanel.createtablemodel();
+ am.searchpanel.setVisible(true);
+ }
+ else if(lastpanel.getName().equals("Users Panel"))
+ {
+ am.userspanel.createtablemodel();
+ am.userspanel.setVisible(true);
+ }
+ else if(lastpanel.getName().equals("Marksheet Report Panel Scroll"))
+ {
+ am.marksheetreportpanel.createtablemodel();
+ am.marksheetreportpanelscroll.setVisible(true);
+ }
+ else
+ {
+ lastpanel.setVisible(true);
+ }
+
+
+ }
+ });
+ editdetailsbutton.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+
+ AddStudentDialog as=new AddStudentDialog(am,s);
+ as.setLocationRelativeTo(null);
+ as.setVisible(true);
+
+
+ }
+
+ }
+ );
+
+
+
+ }
+ public ViewStudentPanel(Student s,FacultyMain fm,JComponent lastpanel)
+ {
+ this(s);
+ this.fm=fm;
+ this.lastpanel=lastpanel;
+
+ editdetailsbutton.setVisible(false);
+ marksheetbutton.setLocation(editdetailsbutton.getX(), editdetailsbutton.getY());
+ marksheetbutton.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ // TODO Auto-generated method stub
+ fm.viewstudentpanel.setVisible(false);
+ fm.marksheetpanel=new MarkSheetPanel(fm,s);
+ fm.marksheetpanel.setVisible(true);
+ fm.marksheetpanelscroll=new JScrollPane(fm.marksheetpanel,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ fm.marksheetpanelscroll.getVerticalScrollBar().setUnitIncrement(16);
+ fm.marksheetpanelscroll.setBounds(fm.panelx, fm.panely, 1116, 705);
+ fm.contentPane.add(fm.marksheetpanelscroll);
+ fm.marksheetpanelscroll.setVisible(true);
+ }
+
+ }
+
+ );
+
+ backbutton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ fm.viewstudentpanel.setVisible(false);
+ if(lastpanel.getName().equals("Student Panel"))
+ {
+ if(fm.studentpanel.viewbutton.getText().equals("Photo View"))
+ {
+ fm.studentpanel.createtablemodel();
+ }
+ else
+ {
+ fm.studentpanel.createphotopanel();
+ }
+ fm.studentpanel.setVisible(true);
+ }
+ else if(lastpanel.getName().equals("Attadance Report Panel Scroll"))
+ {
+ fm.attandancereportpanel.createtablemodel();
+ fm.attandancereportpanelscroll.setVisible(true);
+ }
+ else if(lastpanel.getName().equals("Search Panel"))
+ {
+ fm.searchpanel.createtablemodel();
+ fm.searchpanel.setVisible(true);
+ }
+ else if(lastpanel.getName().equals("Marksheet Report Panel Scroll"))
+ {
+ fm.marksheetreportpanel.createtablemodel();
+ fm.marksheetreportpanelscroll.setVisible(true);
+ }
+ else
+ {
+ lastpanel.setVisible(true);
+ }
+
+ }
+ });
+
+ }
+ public ViewStudentPanel(Student s,StudentMain sm,JComponent lastpanel)
+ {
+ this(s);
+ this.sm=sm;
+ this.lastpanel=lastpanel;
+
+ editdetailsbutton.setVisible(false);
+ marksheetbutton.setVisible(false);
+
+ backbutton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent arg0) {
+ sm.viewstudentpanel.setVisible(false);
+ if(lastpanel.getName().equals("Student Panel"))
+ {
+ if(sm.studentpanel.viewbutton.getText().equals("Photo View"))
+ {
+ sm.studentpanel.createtablemodel();
+ }
+ else
+ {
+ sm.studentpanel.createphotopanel();
+ }
+ sm.studentpanel.setVisible(true);
+ }
+ else if(lastpanel.getName().equals("Attadance Report Panel Scroll"))
+ {
+ sm.attandancereportpanel.createtablemodel();
+ sm.attandancereportpanelscroll.setVisible(true);
+ }
+ else if(lastpanel.getName().equals("Search Panel"))
+ {
+ sm.searchpanel.createtablemodel();
+ sm.searchpanel.setVisible(true);
+ }
+ else
+ {
+ lastpanel.setVisible(true);
+ }
+
+ }
+ });
+ }
+ public ViewStudentPanel(Student s,StudentMain sm)
+ {
+ this(s);
+ this.sm=sm;
+
+ editdetailsbutton.setText("Change Password");
+ marksheetbutton.setVisible(false);
+ backbutton.setVisible(false);
+ editdetailsbutton.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+
+ ChangePasswordDialog cp=new ChangePasswordDialog(s);
+ cp.setLocationRelativeTo(null);
+ cp.setVisible(true);
+
+ }
+
+ }
+ );
+
+
+ }
+}
+
diff --git a/src/collegeapplication/subject/AddSubjectDialog.java b/src/collegeapplication/subject/AddSubjectDialog.java
new file mode 100644
index 0000000..aa7aca3
--- /dev/null
+++ b/src/collegeapplication/subject/AddSubjectDialog.java
@@ -0,0 +1,347 @@
+package collegeapplication.subject;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Dialog;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.sql.ResultSet;
+
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.SwingConstants;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.MatteBorder;
+import javax.swing.table.DefaultTableCellRenderer;
+
+import net.proteanit.sql.DbUtils;
+
+/*
+ * Title : AddSubjectDialog.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : For adding new subject to cource
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+@SuppressWarnings("serial")
+public class AddSubjectDialog extends JDialog implements ActionListener
+{
+
+ private final JPanel contentPanel = new JPanel();
+ private JTextField subjectcodefield;
+ private JTextField subjectnamefield;
+ private JTextField theorymarksfield;
+ private JTextField practicalmarksfield;
+ private JButton addsubject;
+ private JComboBox courcetypecombo;
+ private String Courcecode;
+ private int semoryear;
+ private JTable table;
+ private JLabel lblError;
+ private static AddSubjectDialog dialog;
+ /**
+ * Launch the application.
+ */
+ public static void main(String[] args) {
+ try {
+ dialog = new AddSubjectDialog("IT",1,null);
+ dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+ dialog.setLocationRelativeTo(null);
+ dialog.setVisible(true);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Create the dialog.
+ */
+ public AddSubjectDialog(String courceCode,int sem,JTable datatable) {
+
+ super(dialog,"",Dialog.ModalityType.APPLICATION_MODAL);
+ setBackground(new Color(0, 128, 128));
+ this.table=datatable;
+ this.semoryear=sem;
+ this.Courcecode=courceCode;
+ setResizable(false);
+ setSize(518, 488);
+ getContentPane().setLayout(new BorderLayout());
+ contentPanel.setBackground(new Color(255, 255, 255));
+ contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
+ getContentPane().add(contentPanel, BorderLayout.CENTER);
+ contentPanel.setLayout(null);
+
+ JLabel lblNewLabel = new JLabel("Subject Code");
+ lblNewLabel.setForeground(Color.DARK_GRAY);
+ lblNewLabel.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ lblNewLabel.setBounds(30, 71, 132, 35);
+ contentPanel.add(lblNewLabel);
+
+ JLabel lblSubjectName = new JLabel("Subject Name");
+ lblSubjectName.setForeground(Color.DARK_GRAY);
+ lblSubjectName.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ lblSubjectName.setBounds(30, 134, 132, 35);
+ contentPanel.add(lblSubjectName);
+
+ JLabel lblCourceType = new JLabel("Cource Type");
+ lblCourceType.setForeground(Color.DARK_GRAY);
+ lblCourceType.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ lblCourceType.setBounds(30, 198, 132, 36);
+ contentPanel.add(lblCourceType);
+
+ JLabel lblTheoryMarks = new JLabel("Theory Marks");
+ lblTheoryMarks.setForeground(Color.DARK_GRAY);
+ lblTheoryMarks.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ lblTheoryMarks.setBounds(30, 265, 132, 35);
+ contentPanel.add(lblTheoryMarks);
+
+ JLabel lblPracticalMarks = new JLabel("Practical Marks");
+ lblPracticalMarks.setForeground(Color.DARK_GRAY);
+ lblPracticalMarks.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ lblPracticalMarks.setBounds(30, 332, 132, 35);
+ contentPanel.add(lblPracticalMarks);
+
+ subjectcodefield = new JTextField();
+ subjectcodefield.setEditable(false);
+ subjectcodefield.setText(new SubjectData().createSubjectcode(Courcecode, sem));
+
+ subjectcodefield.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ subjectcodefield.setBounds(172, 70, 331, 40);
+ contentPanel.add(subjectcodefield);
+ subjectcodefield.setColumns(10);
+
+ subjectnamefield = new JTextField();
+ subjectnamefield.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if(e.getKeyCode()==KeyEvent.VK_ENTER)
+ {
+ subjectnamefield.setFocusable(false);
+ theorymarksfield.setFocusable(true);
+ }
+ }
+ });
+ subjectnamefield.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent arg0) {
+ subjectnamefield.setFocusable(true);
+ }
+ });
+ subjectnamefield.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ subjectnamefield.setColumns(10);
+ subjectnamefield.setBounds(172, 136, 331, 40);
+ contentPanel.add(subjectnamefield);
+
+ theorymarksfield = new JTextField();
+ theorymarksfield.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if(e.getKeyCode()==KeyEvent.VK_ENTER)
+ {
+ theorymarksfield.setFocusable(false);
+ practicalmarksfield.setFocusable(true);
+ }
+ }
+ });
+ theorymarksfield.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent arg0) {
+ theorymarksfield.setFocusable(true);
+ }
+ });
+ theorymarksfield.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ theorymarksfield.setColumns(10);
+
+ theorymarksfield.setBounds(172, 267, 331, 40);
+ contentPanel.add(theorymarksfield);
+
+ practicalmarksfield = new JTextField();
+ practicalmarksfield.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent arg0) {
+ practicalmarksfield.setFocusable(true);
+ }
+ });
+ practicalmarksfield.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ practicalmarksfield.setColumns(10);
+ practicalmarksfield.setBounds(172, 334, 331, 40);
+ contentPanel.add(practicalmarksfield);
+
+ courcetypecombo = new JComboBox();
+ courcetypecombo.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ courcetypecombo.setModel(new DefaultComboBoxModel(new String[] {"---select---", "core", "optional"}));
+ courcetypecombo.setFocusable(false);
+ courcetypecombo.setBackground(Color.WHITE);
+ courcetypecombo.setBounds(172, 199, 330, 40);
+ contentPanel.add(courcetypecombo);
+
+ JLabel headerlabel = new JLabel(" Add New Subject");
+ headerlabel.setHorizontalAlignment(SwingConstants.CENTER);
+ headerlabel.setBackground(new Color(32, 178, 170));
+ headerlabel.setOpaque(true);
+ headerlabel.setForeground(new Color(255, 255, 255));
+ headerlabel.setFont(new Font("Arial", Font.BOLD, 23));
+ headerlabel.setBounds(0, 0, 512, 44);
+ headerlabel.setBorder(new MatteBorder(0, 0, 1, 0, (Color) Color.LIGHT_GRAY));
+ contentPanel.add(headerlabel);
+
+ addsubject = new JButton("Add Subject");
+ addsubject.setBorder(new EmptyBorder(0, 0, 0, 0));
+ addsubject.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseEntered(MouseEvent arg0) {
+ HandCursor();
+
+ }
+ public void mouseExited(MouseEvent e)
+ {
+ DefaultCursor();
+ }
+ });
+
+ addsubject.setBackground(new Color(32, 178, 170));
+ addsubject.setForeground(Color.WHITE);
+ addsubject.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ addsubject.setBounds(363, 413, 139, 33);
+ addsubject.addActionListener(this);
+ addsubject.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ addsubject.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ addsubject.setFocusable(false);
+
+ contentPanel.add(addsubject);
+
+ JLabel borderlabel = new JLabel("");
+ borderlabel.setBounds(0, 388, 512, 14);
+ contentPanel.add(borderlabel);
+ borderlabel.setBorder(new MatteBorder(0, 0, 1, 0, (Color) new Color(192, 192, 192)));
+
+ lblError = new JLabel("This is required question !");
+ lblError.setBorder(new MatteBorder(0, 0, 0, 0, (Color) new Color(255, 0, 0)));
+ lblError.setForeground(Color.RED);
+ lblError.setFont(new Font("Candara", Font.PLAIN, 17));
+ lblError.setBounds(172, 107, 331, 30);
+ lblError.setVisible(false);
+ contentPanel.add(lblError);
+
+ }
+ public void HandCursor()
+ {
+ this.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ }
+ public void DefaultCursor()
+ {
+ this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ lblError.setVisible(false);
+ lblError.setText("This is required question..!=-");
+ if(subjectnamefield.getText().isEmpty())
+ {
+ lblError.setVisible(true);
+ lblError.setBounds(subjectnamefield.getX(), subjectnamefield.getY()+subjectnamefield.getHeight()-5, 331, 30);
+ }
+ else if(courcetypecombo.getSelectedIndex()==0)
+ {
+ lblError.setVisible(true);
+ lblError.setBounds(courcetypecombo.getX(), courcetypecombo.getY()+courcetypecombo.getHeight()-5, 331, 30);
+ }
+
+ else if(theorymarksfield.getText().isEmpty()||subjectnamefield.getText().isEmpty())
+ {
+ lblError.setVisible(true);
+ lblError.setBounds(theorymarksfield.getX(), theorymarksfield.getY()+theorymarksfield.getHeight()-5, 331, 30);
+ }
+ else if(practicalmarksfield.getText().isEmpty())
+ {
+ lblError.setVisible(true);
+ lblError.setBounds(practicalmarksfield.getX(), practicalmarksfield.getY()+practicalmarksfield.getHeight()-5, 331, 30);
+ }
+ else if(new SubjectData().isExist(Courcecode,semoryear,subjectnamefield.getText()))
+ {
+ lblError.setVisible(true);
+ lblError.setBounds(subjectnamefield.getX(), subjectnamefield.getY()+subjectnamefield.getHeight()-5, 331, 30);
+ lblError.setText("Subject name already exist..!");
+ }
+ else
+ {
+ if(e.getSource()==addsubject)
+ {
+ String numbererror="";
+ try
+ {
+ String subjectcode=subjectcodefield.getText();
+ String subjectname=subjectnamefield.getText();
+
+ String subjecttype=(String) courcetypecombo.getSelectedItem();
+ numbererror="theorymarks";
+ int theorymarks=Integer.parseInt(theorymarksfield.getText());
+ numbererror="practicalmarks";
+ int practicalmarks=Integer.parseInt(practicalmarksfield.getText());
+ Subject su=new Subject();
+ su.setSubjectName(subjectname);
+ su.setSubjectCode(subjectcode);
+ su.setMaxPracticalMarks(practicalmarks);
+ su.setCourceCode(Courcecode);
+ su.setSemorYear(semoryear);
+ su.setSubjectType(subjecttype);
+ su.setMaxTheoryMarks(theorymarks);
+ int result=new SubjectData().addSubject(su);
+ if(result==1)
+ {
+ ResultSet st=new SubjectData().getSubjectinfo(Courcecode,semoryear);
+ table.setModel(DbUtils.resultSetToTableModel(st));
+ DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
+ centerRenderer.setHorizontalAlignment( JLabel.CENTER );
+ table.getColumnModel().getColumn(0).setCellRenderer( centerRenderer );
+ table.getColumnModel().getColumn(1).setCellRenderer( centerRenderer );
+ table.getColumnModel().getColumn(2).setCellRenderer( centerRenderer );
+ table.getColumnModel().getColumn(3).setCellRenderer( centerRenderer );
+ table.getColumnModel().getColumn(4).setCellRenderer( centerRenderer );
+ table.getColumnModel().getColumn(5).setCellRenderer( centerRenderer );
+ table.getColumnModel().getColumn(0).setMaxWidth(200);
+
+ table.getColumnModel().getColumn(1).setMaxWidth(400);
+ table.getColumnModel().getColumn(2).setMaxWidth(200);
+ table.getColumnModel().getColumn(3).setMaxWidth(200);
+ table.getColumnModel().getColumn(4).setMaxWidth(200);
+ table.getColumnModel().getColumn(5).setMaxWidth(200);
+ this.dispose();
+ }
+ }
+ catch(NumberFormatException exp)
+ {
+ if(numbererror.equals("theorymarks"))
+ {
+ lblError.setBounds(theorymarksfield.getX(), theorymarksfield.getY()+theorymarksfield.getHeight(), 331, 30);
+ }
+ if(numbererror.equals("practicalmarks"))
+ {
+ lblError.setBounds(practicalmarksfield.getX(), practicalmarksfield.getY()+practicalmarksfield.getHeight(), 331, 30);
+ }
+ lblError.setVisible(true);
+ lblError.setText("Characters are not allowed !");
+ }
+ }
+ }
+
+
+
+ }
+
+
+}
diff --git a/src/collegeapplication/subject/AssignSubjectDialog.java b/src/collegeapplication/subject/AssignSubjectDialog.java
new file mode 100644
index 0000000..eddb1bd
--- /dev/null
+++ b/src/collegeapplication/subject/AssignSubjectDialog.java
@@ -0,0 +1,332 @@
+package collegeapplication.subject;
+
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Dialog;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingConstants;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.LineBorder;
+import javax.swing.border.MatteBorder;
+
+import collegeapplication.admin.AdminMain;
+import collegeapplication.cource.CourceData;
+import collegeapplication.faculty.Faculty;
+import collegeapplication.faculty.FacultyData;
+import collegeapplication.faculty.ViewFacultyPanel;
+
+/*
+ * Title : AssignSubjectDialog.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : For assigning subject to faculty
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+@SuppressWarnings("serial")
+public class AssignSubjectDialog extends JDialog implements ActionListener {
+
+ private final JPanel contentPanel = new JPanel();
+ Faculty f=null;
+ static AssignSubjectDialog dialog;
+ private JComboBox courcenamecombo,semoryearcombo,subjectnamecombo,positioncombo;
+ private JButton assignsubjectbutton;
+ private AdminMain am;
+ JLabel Errorlabel;
+
+ /**
+ * Launch the application.
+ */
+ public static void main(String[] args) {
+ try {
+ dialog = new AssignSubjectDialog(null);
+ dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
+
+ dialog.setVisible(true);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Create the dialog.
+ * @param f
+ * @wbp.parser.constructor
+ */
+ private AssignSubjectDialog(Faculty f) {
+
+ super(dialog,"",Dialog.ModalityType.APPLICATION_MODAL);
+ this.setLocation(450, 100);
+
+ getContentPane().setBackground(Color.WHITE);
+ this.f=f;
+ setSize(521, 580);
+ getContentPane().setLayout(null);
+
+ JLabel headerlabel = new JLabel("Assign Subject");
+ headerlabel.setHorizontalAlignment(SwingConstants.CENTER);
+ headerlabel.setBackground(new Color(32, 178, 170));
+ headerlabel.setOpaque(true);
+ headerlabel.setForeground(new Color(255, 255, 255));
+ headerlabel.setFont(new Font("Arial", Font.BOLD, 23));
+ headerlabel.setBorder(new MatteBorder(0, 0, 1, 0, (Color) Color.LIGHT_GRAY));
+ headerlabel.setBounds(0, 0, 505, 39);
+ getContentPane().add(headerlabel);
+
+ JLabel lblImage = new JLabel();
+ lblImage.setBounds(34, 50, 98, 111);
+
+ lblImage.setIcon(new ImageIcon(f.getProfilePic(lblImage.getWidth(), lblImage.getHeight())));
+ lblImage.setBorder(new LineBorder(new Color(192, 192, 192), 2));
+ lblImage.setOpaque(true);
+ lblImage.setBackground(new Color(240, 255, 255));
+ lblImage.setHorizontalAlignment(SwingConstants.CENTER);
+ getContentPane().add(lblImage);
+
+ JLabel lblFacultyName = new JLabel("Faculty Name : "+f.getFacultyName());
+ lblFacultyName.setHorizontalAlignment(SwingConstants.LEFT);
+ lblFacultyName.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ lblFacultyName.setBounds(156, 77, 293, 29);
+ getContentPane().add(lblFacultyName);
+
+ JLabel lblDegree = new JLabel("Qualification : "+f.getQualification());
+ lblDegree.setHorizontalAlignment(SwingConstants.LEFT);
+ lblDegree.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ lblDegree.setBounds(156, 108, 293, 26);
+ getContentPane().add(lblDegree);
+
+ JLabel lblExperience = new JLabel("Experience : "+f.getExperience());
+ lblExperience.setHorizontalAlignment(SwingConstants.LEFT);
+ lblExperience.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ lblExperience.setBounds(156, 138, 293, 26);
+ getContentPane().add(lblExperience);
+
+ JLabel lblFacultyId = new JLabel("Faculty ID : "+f.getFacultyId());
+ lblFacultyId.setHorizontalAlignment(SwingConstants.LEFT);
+ lblFacultyId.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ lblFacultyId.setBounds(156, 50, 323, 22);
+ getContentPane().add(lblFacultyId);
+
+ courcenamecombo = new JComboBox(new CourceData().getCourceName());
+ courcenamecombo.setFocusable(false);
+ courcenamecombo.addActionListener(this);
+ courcenamecombo.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ courcenamecombo.setBackground(new Color(255, 255, 255));
+ courcenamecombo.setBounds(156, 199, 338, 39);
+ getContentPane().add(courcenamecombo);
+
+ JLabel lblCourceName = new JLabel("Cource Name :");
+ lblCourceName.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblCourceName.setFont(new Font("Candara", Font.PLAIN, 18));
+ lblCourceName.setBounds(10, 199, 138, 39);
+ getContentPane().add(lblCourceName);
+
+ JLabel lblSelectSemyear = new JLabel("Semster/Year :");
+ lblSelectSemyear.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblSelectSemyear.setFont(new Font("Candara", Font.PLAIN, 18));
+ lblSelectSemyear.setBounds(10, 265, 138, 37);
+ getContentPane().add(lblSelectSemyear);
+
+ semoryearcombo = new JComboBox();
+ semoryearcombo.setFocusable(false);
+ semoryearcombo.addActionListener(this);
+ semoryearcombo.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ semoryearcombo.setBackground(Color.WHITE);
+ semoryearcombo.setBounds(156, 265, 338, 39);
+ getContentPane().add(semoryearcombo);
+
+ JLabel lblSubject = new JLabel("Subject :");
+ lblSubject.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblSubject.setFont(new Font("Candara", Font.PLAIN, 18));
+ lblSubject.setBounds(10, 332, 138, 37);
+ getContentPane().add(lblSubject);
+
+ subjectnamecombo = new JComboBox();
+ subjectnamecombo.addActionListener(this);
+ subjectnamecombo.setFocusable(false);
+ subjectnamecombo.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ subjectnamecombo.setBackground(Color.WHITE);
+ subjectnamecombo.setBounds(156, 332, 338, 39);
+ getContentPane().add(subjectnamecombo);
+
+ JLabel lblPosition = new JLabel("Position :");
+ lblPosition.setHorizontalAlignment(SwingConstants.RIGHT);
+ lblPosition.setFont(new Font("Candara", Font.PLAIN, 18));
+ lblPosition.setBounds(10, 397, 138, 37);
+ getContentPane().add(lblPosition);
+
+ positioncombo = new JComboBox();
+ positioncombo.setFocusable(false);
+ positioncombo.addActionListener(this);
+ positioncombo.setModel(new DefaultComboBoxModel(new String[] {"---Select Position---", "Full Professor", "Associate Professor", "Assistant Professor", "Lecturer", "lab Assitant"}));
+ positioncombo.setFont(new Font("Segoe UI", Font.PLAIN, 17));
+ positioncombo.setBackground(Color.WHITE);
+ positioncombo.setBounds(156, 397, 338, 39);
+ getContentPane().add(positioncombo);
+
+ assignsubjectbutton = new JButton("Assign Subject");
+ assignsubjectbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ assignsubjectbutton.setFocusable(false);
+ assignsubjectbutton.addActionListener(this);
+ assignsubjectbutton.setBackground(new Color(32, 178, 170));
+ assignsubjectbutton.setForeground(new Color(255, 255, 255));
+ assignsubjectbutton.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ assignsubjectbutton.setBounds(356, 485, 139, 37);
+ assignsubjectbutton.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ getContentPane().add(assignsubjectbutton);
+
+ JLabel label = new JLabel("");
+ label.setBorder(new MatteBorder(0, 0, 2, 0, (Color) new Color(192, 192, 192)));
+ label.setBounds(0, 462, 505, 8);
+ getContentPane().add(label);
+
+ JLabel label_1 = new JLabel("");
+ label_1.setBorder(new MatteBorder(0, 0, 2, 0, (Color) new Color(192, 192, 192)));
+ label_1.setBounds(0, 172, 505, 8);
+ getContentPane().add(label_1);
+
+ Errorlabel = new JLabel("This is required question !");
+ Errorlabel.setVisible(false);
+ Errorlabel.setForeground(Color.RED);
+ Errorlabel.setFont(new Font("Arial", Font.PLAIN, 14));
+ Errorlabel.setBounds(156, 236, 215, 22);
+ getContentPane().add(Errorlabel);
+
+ contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
+ contentPanel.setLayout(null);
+ if(!f.getCourceCode().equals("Not Assigned"))
+ {
+ this.setDataInComboBox();
+ }
+
+ }
+
+ public AssignSubjectDialog(Faculty f, AdminMain am)
+ {
+ // TODO Auto-generated constructor stub
+ this(f);
+ this.am=am;
+
+ }
+ public void setDataInComboBox()
+ {
+ courcenamecombo.setSelectedItem(new CourceData().getcourcename(f.getCourceCode()));
+ semoryearcombo.setModel(new DefaultComboBoxModel(new CourceData().getSemorYear(courcenamecombo.getSelectedItem()+"")));
+ String[] totalsub=new SubjectData().getSubjectinCource(f.getCourceCode(),f.getSemorYear());
+ subjectnamecombo.setModel(new DefaultComboBoxModel(totalsub));
+ semoryearcombo.setSelectedIndex(f.getSemorYear());
+ subjectnamecombo.setSelectedItem(f.getSubject());
+ positioncombo.setSelectedItem(f.getPosition());
+ }
+
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO Auto-generated method stub
+ Errorlabel.setVisible(false);
+ if(e.getSource()==courcenamecombo)
+ {
+ courcenamecombo.setFocusable(false);
+
+ subjectnamecombo.setModel(new DefaultComboBoxModel(new String[] {""}));
+ if(courcenamecombo.getSelectedIndex()==0)
+ {
+ semoryearcombo.setModel(new DefaultComboBoxModel(new String[] {""}));
+
+ }
+ else
+ {
+ String cource=(String) courcenamecombo.getSelectedItem();
+
+ semoryearcombo.setModel(new DefaultComboBoxModel(new CourceData().getSemorYear(cource)));
+ }
+
+ }
+ if(e.getSource()==semoryearcombo && semoryearcombo.getSelectedIndex()>0)
+ {
+ String cource=(String) courcenamecombo.getSelectedItem();
+
+ String[] totalsub=new SubjectData().getSubjectinCource(new CourceData().getCourcecode(cource), semoryearcombo.getSelectedIndex());
+ if(totalsub!=null)
+ {
+ subjectnamecombo.setModel(new DefaultComboBoxModel(totalsub));
+ }
+ else
+ {
+ subjectnamecombo.setModel(new DefaultComboBoxModel(new String[] {"No Subject"}));
+
+ }
+ }
+ if(e.getSource()==assignsubjectbutton)
+ {
+ if(courcenamecombo.getSelectedIndex()==0)
+ {
+ showerror(courcenamecombo);
+ }
+ else if(semoryearcombo.getSelectedIndex()==0)
+ {
+ showerror(semoryearcombo);
+ }
+ else if(subjectnamecombo.getSelectedIndex()==0)
+ {
+ showerror(subjectnamecombo);
+ }
+ else if(positioncombo.getSelectedIndex()==0)
+ {
+ showerror(positioncombo);
+ }
+ else
+ {
+ Faculty fnew=new Faculty();
+
+ fnew.setCourceCode(new CourceData().getCourcecode(courcenamecombo.getSelectedItem()+""));
+ fnew.setPosition(positioncombo.getSelectedItem()+"");
+ fnew.setSemorYear(semoryearcombo.getSelectedIndex());
+ fnew.setSubject(subjectnamecombo.getSelectedItem()+"");
+ fnew.setFacultyId(f.getFacultyId());
+ fnew.setFacultyName(f.getFacultyName());
+ int result=new FacultyData().assignSubject(f,fnew);
+ if(result>0)
+ {
+ if(am!=null)
+ {
+ if(am.assignsubjectpanel!=null&&am.assignsubjectpanel.isVisible())
+ {
+ am.assignsubjectpanel.createtablemodel();
+ }
+
+ else if(am.viewfacultypanel!=null&&am.viewfacultypanel.isVisible())
+ {
+ System.out.println("updateing ");
+ am.viewfacultypanel.setVisible(false);
+ am.viewfacultypanel=new ViewFacultyPanel(new FacultyData().getFacultyInfobyId(f.getFacultyId()),am,am.viewfacultypanel.lastpanel);
+ am.viewfacultypanel.setVisible(true);
+ am.viewfacultypanel.setLocation(am.panelx, am.panely);
+ am.getContentPane().add(am.viewfacultypanel);
+ }
+ }
+
+ this.dispose();
+ }
+ }
+ }
+
+
+ }
+ public void showerror(JComponent tf)
+ {
+ Errorlabel.setVisible(true);
+ Errorlabel.setBounds(tf.getX(), tf.getY()+tf.getHeight()-5, 400,26);
+ }
+
+}
diff --git a/src/collegeapplication/subject/AssignSubjectPanel.java b/src/collegeapplication/subject/AssignSubjectPanel.java
new file mode 100644
index 0000000..d253573
--- /dev/null
+++ b/src/collegeapplication/subject/AssignSubjectPanel.java
@@ -0,0 +1,172 @@
+package collegeapplication.subject;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.sql.ResultSet;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.SwingConstants;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.LineBorder;
+import javax.swing.table.DefaultTableCellRenderer;
+
+import collegeapplication.admin.AdminMain;
+import collegeapplication.faculty.Faculty;
+import collegeapplication.faculty.FacultyData;
+import collegeapplication.faculty.FacultyMain;
+import collegeapplication.student.StudentMain;
+import net.proteanit.sql.DbUtils;
+
+/*
+ * Title : AssignSubjectPanel.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : Displaying all the faculty with assigned subject
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+@SuppressWarnings("serial")
+public class AssignSubjectPanel extends JPanel {
+
+ private JPanel tableviewpanel;
+ private JTable table;
+ String condition="";
+ /**
+ * Create the panel.
+ */
+ public AssignSubjectPanel(AdminMain am)
+ {
+ this();
+ table.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent e)
+ {
+ if(e.getClickCount()>1 && e.getButton()==MouseEvent.BUTTON1)
+ {
+
+ JTable t=(JTable) e.getSource();
+ Faculty f=new FacultyData().getFacultyInfo(t.getSelectedRow()+1);
+ AssignSubjectDialog as=new AssignSubjectDialog(f,am);
+ as.setLocationRelativeTo(null);
+ as.setVisible(true);
+
+ }
+
+ }
+ });
+ condition="";
+ }
+ public AssignSubjectPanel(FacultyMain fm)
+ {
+ this();
+ condition=" where courcecode='"+fm.f.getCourceCode()+"' and semoryear="+fm.f.getSemorYear()+" ";
+ table.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
+ this.createtablemodel();
+
+ }
+ public AssignSubjectPanel(StudentMain sm)
+ {
+ this();
+ condition=" where courcecode='"+sm.s.getCourceCode()+"' and semoryear="+sm.s.getSemorYear()+" ";
+ table.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
+ this.createtablemodel();
+
+
+ }
+ private AssignSubjectPanel() {
+
+ setBackground(Color.WHITE);
+ this.setSize(1116, 705);
+ setLayout(null);
+ JPanel panel = new JPanel();
+ panel.setBackground(new Color(32, 178, 170));
+ panel.setBounds(10, 0, 1096, 183);
+ add(panel);
+ panel.setLayout(null);
+ JLabel allfaculitieslabel = new JLabel("Subject Faculties");
+ allfaculitieslabel.setIcon(null);
+ allfaculitieslabel.setBounds(10, 65, 272, 44);
+ panel.add(allfaculitieslabel);
+ allfaculitieslabel.setBackground(new Color(32, 178, 170));
+ allfaculitieslabel.setHorizontalAlignment(SwingConstants.LEFT);
+ allfaculitieslabel.setForeground(Color.WHITE);
+ allfaculitieslabel.setFont(new Font("Segoe UI", Font.BOLD, 30));
+ allfaculitieslabel.setOpaque(true);
+ tableviewpanel = new JPanel();
+ tableviewpanel.setBackground(Color.WHITE);
+ tableviewpanel.setBounds(0, 189, 1116, 528);
+ add(tableviewpanel);
+ tableviewpanel.setLayout(null);
+
+ JScrollPane scrollPane = new JScrollPane();
+ scrollPane.setBounds(10, 11, 1095, 483);
+ scrollPane.setBorder(new EmptyBorder(0, 0, 0, 0));
+ for(Component c : scrollPane.getComponents())
+ {
+ c.setBackground(Color.white);
+ }
+ tableviewpanel.add(scrollPane);
+
+ table = new JTable();
+ createtablemodel();
+ table.setBorder(new LineBorder(Color.LIGHT_GRAY));
+ table.getTableHeader().setBackground(new Color(32,178,170));
+ table.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ table.getTableHeader().setForeground(Color.white);
+ table.getTableHeader().setFont(new Font("Arial",Font.BOLD,20));
+ table.setFont(new Font("Segoe UI",Font.PLAIN,20));
+ table.getTableHeader().setPreferredSize(new Dimension(50,40));
+ table.setDragEnabled(false);
+ table.setRowHeight(40);
+
+ table.setSelectionBackground(new Color(240, 255, 255));
+ table.setFocusable(false);
+// table.setEnabled(false);
+ table.setDefaultEditor(Object.class,null);
+
+ table.setGridColor(Color.LIGHT_GRAY);
+ table.getTableHeader().setReorderingAllowed(false);
+ scrollPane.setViewportView(table);
+
+
+
+
+
+ }
+ public void createtablemodel()
+ {
+ ResultSet rs=new FacultyData().getFacultySubjectInfo(condition);
+
+ if(rs!=null)
+ {
+ table.setModel(DbUtils.resultSetToTableModel(rs));
+ }
+ table.getColumnModel().getColumn(0).setMaxWidth(200);
+ table.getColumnModel().getColumn(1).setMaxWidth(300);
+ table.getColumnModel().getColumn(2).setMaxWidth(180);
+ table.getColumnModel().getColumn(3).setMaxWidth(180);
+ table.getColumnModel().getColumn(4).setMaxWidth(300);
+ table.getColumnModel().getColumn(5).setMaxWidth(300);
+ table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
+ DefaultTableCellRenderer cellrenderer=new DefaultTableCellRenderer();
+ cellrenderer.setHorizontalAlignment(JLabel.CENTER);
+ table.getColumnModel().getColumn(0).setCellRenderer(cellrenderer);
+ for(int i=0; i0)
+ {
+ String[] subject=new String[totalsubjectincource+1];
+ subject[0]="---Select Subject---";
+ String query="select subjectname from subject where courcecode='"+courcecode+"' and semoryear="+sem;
+ try
+ {
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ int i=1;
+ while(rs.next())
+ {
+ subject[i++]=rs.getString(1);
+ }
+ rs.close();
+ st.close();
+ return subject;
+
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ else
+ {
+
+ }
+ return null;
+ }
+ public int getTotalSubjectinCource(String courcecode,int sem)
+ {
+ int totalsubjectincource=0;
+ try
+ {
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery("select subjectname from subject where courcecode='"+courcecode+"' and semoryear="+sem);
+ while(rs.next())
+ {
+ totalsubjectincource++;
+ }
+
+ rs.close();
+ st.close();
+ return totalsubjectincource;
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ return totalsubjectincource;
+ }
+ public String getSubjectCode(String courcecode,int sem,String subjectname)
+ {
+ String subcode=null;
+ String query="select subjectcode from subject where courcecode='"+courcecode+"' and semoryear="+sem+" and subjectname='"+subjectname+"'";
+ try
+ {
+ Statement st=con.createStatement();
+ ResultSet rs=st.executeQuery(query);
+ rs.next();
+ subcode=rs.getString(1);
+
+ }
+ catch(Exception exp)
+ {
+ return null;
+ }
+
+ return subcode;
+
+ }
+}
diff --git a/src/collegeapplication/subject/SubjectPanel.java b/src/collegeapplication/subject/SubjectPanel.java
new file mode 100644
index 0000000..b7babe2
--- /dev/null
+++ b/src/collegeapplication/subject/SubjectPanel.java
@@ -0,0 +1,320 @@
+package collegeapplication.subject;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.sql.ResultSet;
+
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.SwingConstants;
+import javax.swing.Timer;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.LineBorder;
+import javax.swing.table.DefaultTableCellRenderer;
+
+import collegeapplication.admin.AdminMain;
+import collegeapplication.cource.CourceData;
+import collegeapplication.faculty.FacultyMain;
+import collegeapplication.student.StudentMain;
+import net.proteanit.sql.DbUtils;
+
+/*
+ * Title : SubjectPanel.java
+ * Created by : Ajaysinh Rathod
+ * Purpose : Displaying all the subject in given cource and sem
+ * Mail : ajaysinhrathod1290@gmail.com
+ */
+
+@SuppressWarnings("serial")
+public class SubjectPanel extends JPanel implements ActionListener
+{
+
+ /**
+ * Create the panel.
+ */
+ private JComboBox courcenamecombo;
+ private JComboBox semoryearcombo;
+ private JButton addsubject;
+ private String Courcecode[];
+ private JTable table;
+ private JScrollPane scrollPane;
+ private JLabel selectcourcelabel;
+ private JLabel selectsemlabel;
+ private JLabel headerlabel;
+ private JButton backbutton;
+
+ public SubjectPanel(AdminMain am)
+ {
+ this();
+ }
+ public SubjectPanel(StudentMain sm)
+ {
+ this();
+ courcenamecombo.setVisible(false);
+ semoryearcombo.setVisible(false);
+ addsubject.setVisible(false);
+ selectsemlabel.setVisible(false);
+ selectcourcelabel.setVisible(false);
+
+ scrollPane.setVisible(true);
+ headerlabel.setBounds(10, 0, 1096, 183);
+ headerlabel.setText(" Subjects");
+ scrollPane.setBounds(10, headerlabel.getY()+headerlabel.getHeight()+20, 1096, this.getHeight()-headerlabel.getHeight()-20);
+ headerlabel.setHorizontalAlignment(JLabel.LEFT);
+ this.createtablemodel(sm.s.getCourceCode(),sm.s.getSemorYear() );
+
+ }
+ public SubjectPanel(FacultyMain fm)
+ {
+ this();
+ courcenamecombo.setVisible(false);
+ semoryearcombo.setVisible(false);
+ addsubject.setVisible(false);
+ selectsemlabel.setVisible(false);
+ selectcourcelabel.setVisible(false);
+
+ scrollPane.setVisible(true);
+ headerlabel.setBounds(10, 0, 1096, 183);
+ headerlabel.setText(" Subjects");
+ scrollPane.setBounds(10, headerlabel.getY()+headerlabel.getHeight()+20, 1096, this.getHeight()-headerlabel.getHeight()-20);
+ headerlabel.setHorizontalAlignment(JLabel.LEFT);
+ this.createtablemodel(fm.f.getCourceCode(),fm.f.getSemorYear() );
+
+ }
+ public SubjectPanel(FacultyMain fm,JComponent lastpanel)
+ {
+ this(fm);
+ headerlabel.setLayout(null);
+ backbutton = new JButton("Back");
+ backbutton.setContentAreaFilled(false);
+ backbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ backbutton.setIcon(new ImageIcon(".\\assets\\back.png"));
+ backbutton.setFocusable(false);
+ backbutton.setForeground(Color.WHITE);
+ backbutton.setFont(new Font("Segoe UI", Font.BOLD, 16));
+ backbutton.setBackground(new Color(32, 178, 170));
+ backbutton.setBounds(10,141, 88, 36);
+ headerlabel.add(backbutton);
+
+ backbutton.addActionListener(e->
+ {
+ this.setVisible(false);
+ lastpanel.setVisible(true);
+ });
+ }
+ public SubjectPanel(StudentMain sm,JComponent lastpanel)
+ {
+ this(sm);
+ headerlabel.setLayout(null);
+ backbutton = new JButton("Back");
+ backbutton.setContentAreaFilled(false);
+ backbutton.setBorder(new EmptyBorder(0, 0, 0, 0));
+ backbutton.setIcon(new ImageIcon(".\\assets\\back.png"));
+ backbutton.setFocusable(false);
+ backbutton.setForeground(Color.WHITE);
+ backbutton.setFont(new Font("Segoe UI", Font.BOLD, 16));
+ backbutton.setBackground(new Color(32, 178, 170));
+ backbutton.setBounds(10, 141, 88, 36);
+ headerlabel.add(backbutton);
+
+ backbutton.addActionListener(e->
+ {
+ this.setVisible(false);
+ lastpanel.setVisible(true);
+ });
+ }
+
+ private SubjectPanel()
+ {
+ new Timer(100,this);
+// timer.start();
+ setBackground(Color.WHITE);
+ setForeground(Color.WHITE);
+ this.setSize(1116, 705);
+ setLayout(null);
+ headerlabel = new JLabel("Subject Management");
+ headerlabel.setBackground(new Color(32, 178, 170));
+ headerlabel.setHorizontalAlignment(SwingConstants.CENTER);
+ headerlabel.setForeground(new Color(255, 255, 255));
+ headerlabel.setFont(new Font("Segoe UI", Font.BOLD, 30));
+ headerlabel.setBounds(10, 0, 1096, 66);
+ headerlabel.setOpaque(true);
+ add(headerlabel);
+
+ selectcourcelabel = new JLabel("Select Cource ");
+ selectcourcelabel.setHorizontalAlignment(SwingConstants.LEFT);
+ selectcourcelabel.setForeground(Color.DARK_GRAY);
+ selectcourcelabel.setFont(new Font("Segoe UI", Font.PLAIN, 20));
+ selectcourcelabel.setBounds(30, 89, 248, 42);
+ add(selectcourcelabel);
+
+ courcenamecombo = new JComboBox(new CourceData().getCourceName());
+ courcenamecombo.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ courcenamecombo.setBackground(Color.WHITE);
+ courcenamecombo.setFocusable(false);
+ courcenamecombo.addActionListener(this);
+ courcenamecombo.setBounds(300, 88, 806, 42);
+ add(courcenamecombo);
+
+ selectsemlabel = new JLabel("Select Semester/Year ");
+ selectsemlabel.setHorizontalAlignment(SwingConstants.LEFT);
+ selectsemlabel.setBackground(Color.DARK_GRAY);
+ selectsemlabel.setForeground(Color.DARK_GRAY);
+ selectsemlabel.setFont(new Font("Segoe UI", Font.PLAIN, 20));
+ selectsemlabel.setBounds(30, 165, 248, 40);
+ add(selectsemlabel);
+
+ semoryearcombo = new JComboBox();
+ semoryearcombo.setMaximumRowCount(16);
+ semoryearcombo.setFont(new Font("Segoe UI", Font.PLAIN, 18));
+ semoryearcombo.setBackground(Color.WHITE);
+ semoryearcombo.setFocusable(false);
+ semoryearcombo.addActionListener(this);
+ semoryearcombo.setBounds(300, 165, 806, 42);
+ add(semoryearcombo);
+
+ Courcecode=new CourceData().getCourcecode();
+
+ addsubject = new JButton("Add New Subject");
+ addsubject.setBorder(new EmptyBorder(0, 0, 0, 0));
+ addsubject.addActionListener(this);
+ addsubject.setForeground(new Color(255, 255, 255));
+ addsubject.setBackground(new Color(32, 178, 170));
+ addsubject.setFont(new Font("Segoe UI", Font.BOLD, 15));
+ addsubject.setBounds(937, 242, 169, 37);
+ addsubject.setVisible(false);
+ addsubject.setFocusable(false);
+ addsubject.setCursor(new Cursor(Cursor.HAND_CURSOR));
+ add(addsubject);
+
+ scrollPane = new JScrollPane();
+ scrollPane.setBorder(new EmptyBorder(0, 0, 0, 0));
+ scrollPane.setBounds(10, 311, 1096, 361);
+ for(Component c:scrollPane.getComponents())
+ {
+ c.setBackground(Color.white);
+ }
+ add(scrollPane);
+
+ table = new JTable();
+ table.setBorder(new LineBorder(new Color(192, 192, 192), 2));
+ table.setBackground(Color.white);
+ table.setRowHeight(40);
+
+ table.getTableHeader().setBackground(new Color(32, 178, 170));
+ table.getTableHeader().setForeground(Color.white);
+ table.getTableHeader().setFont(new Font("Arial",Font.BOLD,20));
+ table.setFont(new Font("Segoe UI",Font.PLAIN,20));
+ table.getTableHeader().setPreferredSize(new Dimension(50,40));
+ table.setDragEnabled(false);
+
+ table.setGridColor(Color.LIGHT_GRAY);
+ table.getTableHeader().setReorderingAllowed(false);
+
+ table.setEnabled(false);
+ scrollPane.setViewportView(table);
+ scrollPane.setVisible(false);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO Auto-generated method stub
+
+ if(courcenamecombo.getSelectedIndex()==0 ||semoryearcombo.getSelectedIndex()==0)
+ {
+ scrollPane.setVisible(false);
+ }
+ if(e.getSource()==courcenamecombo)
+ {
+
+
+ scrollPane.setVisible(false);
+ addsubject.setVisible(false);
+ if(courcenamecombo.getSelectedIndex()==0)
+ {
+ semoryearcombo.setModel(new DefaultComboBoxModel(new String[] {""}));
+ }
+ else
+ {
+ String cource=(String) courcenamecombo.getSelectedItem();
+
+ semoryearcombo.setModel(new DefaultComboBoxModel(new CourceData().getSemorYear(cource)));
+ }
+
+ }
+ if(e.getSource()==semoryearcombo)
+ {
+ if(courcenamecombo.getSelectedIndex()>0 && semoryearcombo.getSelectedIndex()>0)
+ {
+ scrollPane.setVisible(true);
+ int sem=semoryearcombo.getSelectedIndex();
+ int index=courcenamecombo.getSelectedIndex();
+ this.createtablemodel(Courcecode[index-1], sem);
+
+ }
+ else if(semoryearcombo.getSelectedIndex()==0)
+ {
+ scrollPane.setVisible(false);
+ addsubject.setVisible(false);
+ }
+
+ else
+ {
+ scrollPane.setVisible(false);
+ }
+
+
+ }
+ if(courcenamecombo.getSelectedIndex()>0 && semoryearcombo.getSelectedIndex()>0)
+ {
+ addsubject.setVisible(true);
+ }
+
+ if(e.getSource()==addsubject)
+ {
+ int sem=semoryearcombo.getSelectedIndex();
+ int index=courcenamecombo.getSelectedIndex();
+ AddSubjectDialog sd=new AddSubjectDialog(Courcecode[index-1],sem,table);
+ sd.setLocationRelativeTo(null);
+ sd.setVisible(true);
+
+ scrollPane.setVisible(true);
+
+ }
+ }
+ public void createtablemodel(String courcecode,int sem)
+ {
+ ResultSet st=new SubjectData().getSubjectinfo(courcecode,sem);
+ table.setModel(DbUtils.resultSetToTableModel(st));
+ DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
+ centerRenderer.setHorizontalAlignment( JLabel.CENTER );
+ table.getColumnModel().getColumn(0).setCellRenderer( centerRenderer );
+ table.getColumnModel().getColumn(1).setCellRenderer( centerRenderer );
+ table.getColumnModel().getColumn(2).setCellRenderer( centerRenderer );
+ table.getColumnModel().getColumn(3).setCellRenderer( centerRenderer );
+ table.getColumnModel().getColumn(4).setCellRenderer( centerRenderer );
+ table.getColumnModel().getColumn(5).setCellRenderer( centerRenderer );
+ table.getColumnModel().getColumn(0).setMaxWidth(200);
+
+ table.getColumnModel().getColumn(1).setMaxWidth(400);
+ table.getColumnModel().getColumn(2).setMaxWidth(200);
+ table.getColumnModel().getColumn(3).setMaxWidth(200);
+ table.getColumnModel().getColumn(4).setMaxWidth(200);
+ table.getColumnModel().getColumn(5).setMaxWidth(200);
+
+ }
+
+}