├── .gitignore
├── nbproject
├── private
│ ├── config.properties
│ ├── private.properties
│ └── private.xml
├── genfiles.properties
├── project.xml
└── project.properties
├── manifest.mf
├── src
└── TAMS
│ ├── icons8-back-50.png
│ ├── icons8-back-to-64.png
│ ├── green-mountain-2132180.jpg
│ ├── Mysqlconnect.java
│ ├── vechicleDisp.java
│ ├── NewJFrame.form
│ ├── NewJFrame.java
│ ├── Login.form
│ ├── Login.java
│ ├── Home.form
│ ├── Home.java
│ ├── Employee.form
│ ├── Employee.java
│ ├── Vechicle.form
│ ├── Vechicle.java
│ └── Confirm_book.form
├── TAMS-images
├── Screenshot (131).png
├── Screenshot (132).png
├── Screenshot (21).png
├── Screenshot (22).png
├── Screenshot (23).png
├── Screenshot (24).png
└── Screenshot (25).png
├── README.html
├── README.md
└── TAMS.sql
/.gitignore:
--------------------------------------------------------------------------------
1 | /dist/
--------------------------------------------------------------------------------
/nbproject/private/config.properties:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/src/TAMS/icons8-back-50.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praveenhonavar/Travel-Agency-Management-System/HEAD/src/TAMS/icons8-back-50.png
--------------------------------------------------------------------------------
/src/TAMS/icons8-back-to-64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praveenhonavar/Travel-Agency-Management-System/HEAD/src/TAMS/icons8-back-to-64.png
--------------------------------------------------------------------------------
/TAMS-images/Screenshot (131).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praveenhonavar/Travel-Agency-Management-System/HEAD/TAMS-images/Screenshot (131).png
--------------------------------------------------------------------------------
/TAMS-images/Screenshot (132).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praveenhonavar/Travel-Agency-Management-System/HEAD/TAMS-images/Screenshot (132).png
--------------------------------------------------------------------------------
/TAMS-images/Screenshot (21).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praveenhonavar/Travel-Agency-Management-System/HEAD/TAMS-images/Screenshot (21).png
--------------------------------------------------------------------------------
/TAMS-images/Screenshot (22).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praveenhonavar/Travel-Agency-Management-System/HEAD/TAMS-images/Screenshot (22).png
--------------------------------------------------------------------------------
/TAMS-images/Screenshot (23).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praveenhonavar/Travel-Agency-Management-System/HEAD/TAMS-images/Screenshot (23).png
--------------------------------------------------------------------------------
/TAMS-images/Screenshot (24).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praveenhonavar/Travel-Agency-Management-System/HEAD/TAMS-images/Screenshot (24).png
--------------------------------------------------------------------------------
/TAMS-images/Screenshot (25).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praveenhonavar/Travel-Agency-Management-System/HEAD/TAMS-images/Screenshot (25).png
--------------------------------------------------------------------------------
/src/TAMS/green-mountain-2132180.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praveenhonavar/Travel-Agency-Management-System/HEAD/src/TAMS/green-mountain-2132180.jpg
--------------------------------------------------------------------------------
/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | do.depend=false
3 | do.jar=true
4 | do.jlink=false
5 | javac.debug=true
6 | javadoc.preview=true
7 | jlink.strip=false
8 | user.properties.file=C:\\Users\\HP\\AppData\\Roaming\\NetBeans\\11.1\\build.properties
9 |
--------------------------------------------------------------------------------
/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=c2402c51
2 | build.xml.script.CRC32=17763309
3 | build.xml.stylesheet.CRC32=f85dc8f2@1.92.0.48
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=c2402c51
7 | nbproject/build-impl.xml.script.CRC32=0238bfbd
8 | nbproject/build-impl.xml.stylesheet.CRC32=3a2fa800@1.92.0.48
9 |
--------------------------------------------------------------------------------
/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 | TAMS-KP
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/TAMS/Mysqlconnect.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package TAMS;
7 | import java.sql.*;
8 | import javax.swing.*;
9 |
10 | /**
11 | *
12 | * @author HP
13 | */
14 | public class Mysqlconnect {
15 |
16 | Connection conn=null;
17 | public static Connection ConnectDB(){
18 | try{
19 | Class.forName("com.mysql.jdbc.Driver");
20 |
21 | Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/testdb", "root", "11606");
22 | //JOptionPane.showMessageDialog(null,"connected to databasa");
23 | return conn;
24 |
25 | }
26 | catch (Exception e){
27 | JOptionPane.showMessageDialog(null,e);
28 | return null;
29 | }
30 |
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/README.html:
--------------------------------------------------------------------------------
1 | # **Travel Agency Management System** :blue_car: :oncoming_bus:
2 |
3 | **Travel Agency Management System** is solution to travel agencies to maintain the details of vehicle, employee, trip and the people booking a trip, in an easier and convenient way.
4 |
5 |
6 | ## **Necessity of the project**
7 |
8 | - Nearly everyone goes on a vacation :airplane:, for this ***Travel agency management system*** would play a vital role in planning a perfect trip :100:.
9 |
10 | - The main purpose is to ***help tourism companies to manage its customers and trips***.
11 |
12 |
13 | ## **Applications & Advantages**
14 |
15 | - Provides an ***user interface for the administrator**** for managing the data present in the travel agency.
16 |
17 | - ***Reduces the time***:clock3: of recording the data.
18 |
19 | ## **Techstacks Used**
20 |
21 | - Netbeans
22 | - MySQL
23 | - Java
24 |
25 |
26 | ## **Contributors**
27 |
28 | Kavya
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | file:/C:/Users/HP/Desktop/TAMS-DBMS/src/TAMS/Book_Trip.java
7 | file:/C:/Users/HP/Desktop/TAMS-DBMS/src/TAMS/Vechicle.java
8 | file:/C:/Users/HP/Desktop/TAMS-DBMS/src/TAMS/Home.java
9 | file:/C:/Users/HP/Desktop/TAMS-DBMS/src/TAMS/Employee.java
10 | file:/C:/Users/HP/Desktop/TAMS-DBMS/src/TAMS/Confirm_book.java
11 | file:/C:/Users/HP/Desktop/TAMS-DBMS/src/TAMS/Login.java
12 | file:/C:/Users/HP/Desktop/TAMS-DBMS/src/TAMS/Mysqlconnect.java
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/TAMS/vechicleDisp.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package TAMS;
7 |
8 | /**
9 | *
10 | * @author HP
11 | */
12 | public class vechicleDisp {
13 | private int Vid;
14 | private String Vname;
15 | private String Regno;
16 | private String Type;
17 | private int cap;
18 |
19 | public vechicleDisp(int Vid, String Vname, String Regno,String Type, int cap)
20 | {
21 | this.Vid = Vid;
22 | this.Vname = Vname;
23 | this.Regno = Regno;
24 | this.Type = Type;
25 | this.cap = cap;
26 | }
27 |
28 | public int getVid()
29 | {
30 | return Vid;
31 | }
32 |
33 | public String getVname()
34 | {
35 | return Vname;
36 | }
37 |
38 | public String getRegno()
39 | {
40 | return Regno;
41 | }
42 |
43 | public String getType()
44 | {
45 | return Type;
46 | }
47 |
48 | public int getCap(){
49 | return cap;
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/TAMS/NewJFrame.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
36 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # **Travel Agency Management System** :blue_car: :oncoming_bus:
2 |
3 | **Travel Agency Management System** is solution to travel agencies to maintain the details of vehicle, employee, trip and the people booking a trip, in an easier and convenient way.
4 |
5 |
6 | ## **Necessity of the project**
7 |
8 | - Nearly everyone goes on a vacation :airplane:, for this ***Travel agency management system*** would play a vital role in planning a perfect trip :100:.
9 |
10 | - The main purpose is to ***help tourism companies to manage its customers and trips***.
11 |
12 |
13 | ## **Applications & Advantages**
14 |
15 | - Provides an ***user interface for the administrator*** for managing the data present in the travel agency.
16 |
17 | - ***Reduces the time***:clock3: of recording the data.
18 |
19 | ## **Techstacks Used**
20 |
21 | - Netbeans
22 | - MySQL
23 | - Java
24 |
25 | ## **Demo**
26 |
27 | Click here to watch:point_down:
28 |
29 | Travel Agency Management System
30 |
31 | ## **ER-Diagram**
32 |
33 | .png)
34 |
35 | ## **Schema Diagram**
36 |
37 | .png)
38 |
39 |
40 | ## **Report**
41 |
42 | [Travel Agency Management System Report](https://drive.google.com/file/d/1mtmDH7QAuskuzH7aIIcGP5pBsvSzA8Nu/view?usp=sharing)
43 |
44 | ## **Screenshots**
45 |
46 | Admin Login page :point_down:
47 |
48 | .png)
49 |
50 | Vehicle Dashboard Page :point_down:
51 |
52 | .png)
53 |
54 | Employee Dashboard Page :point_down:
55 |
56 | .png)
57 |
58 |
59 | Booking Dashboard Page :point_down:
60 |
61 | .png)
62 |
63 |
64 | Confirm Booking Page :point_down:
65 |
66 | .png)
67 |
68 |
69 | ## **Contributors**
70 |
71 | ***Kavya Pai***
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/src/TAMS/NewJFrame.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package TAMS;
7 |
8 | /**
9 | *
10 | * @author HP
11 | */
12 | public class NewJFrame extends javax.swing.JFrame {
13 |
14 | /**
15 | * Creates new form NewJFrame
16 | */
17 | public NewJFrame() {
18 | initComponents();
19 | }
20 |
21 | /**
22 | * This method is called from within the constructor to initialize the form.
23 | * WARNING: Do NOT modify this code. The content of this method is always
24 | * regenerated by the Form Editor.
25 | */
26 | @SuppressWarnings("unchecked")
27 | // //GEN-BEGIN:initComponents
28 | private void initComponents() {
29 |
30 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
31 |
32 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
33 | getContentPane().setLayout(layout);
34 | layout.setHorizontalGroup(
35 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
36 | .addGap(0, 400, Short.MAX_VALUE)
37 | );
38 | layout.setVerticalGroup(
39 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
40 | .addGap(0, 300, Short.MAX_VALUE)
41 | );
42 |
43 | pack();
44 | }// //GEN-END:initComponents
45 |
46 | /**
47 | * @param args the command line arguments
48 | */
49 | public static void main(String args[]) {
50 | /* Set the Nimbus look and feel */
51 | //
52 | /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
53 | * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
54 | */
55 | try {
56 | for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
57 | if ("Nimbus".equals(info.getName())) {
58 | javax.swing.UIManager.setLookAndFeel(info.getClassName());
59 | break;
60 | }
61 | }
62 | } catch (ClassNotFoundException ex) {
63 | java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
64 | } catch (InstantiationException ex) {
65 | java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
66 | } catch (IllegalAccessException ex) {
67 | java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
68 | } catch (javax.swing.UnsupportedLookAndFeelException ex) {
69 | java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
70 | }
71 | //
72 |
73 | /* Create and display the form */
74 | java.awt.EventQueue.invokeLater(new Runnable() {
75 | public void run() {
76 | new NewJFrame().setVisible(true);
77 | }
78 | });
79 | }
80 |
81 | // Variables declaration - do not modify//GEN-BEGIN:variables
82 | // End of variables declaration//GEN-END:variables
83 | }
84 |
--------------------------------------------------------------------------------
/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.processors.list=
4 | annotation.processing.run.all.processors=true
5 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
6 | application.title=TAMS-KP
7 | application.vendor=HP
8 | build.classes.dir=${build.dir}/classes
9 | build.classes.excludes=**/*.java,**/*.form
10 | # This directory is removed when the project is cleaned:
11 | build.dir=build
12 | build.generated.dir=${build.dir}/generated
13 | build.generated.sources.dir=${build.dir}/generated-sources
14 | # Only compile against the classpath explicitly listed here:
15 | build.sysclasspath=ignore
16 | build.test.classes.dir=${build.dir}/test/classes
17 | build.test.results.dir=${build.dir}/test/results
18 | # Uncomment to specify the preferred debugger connection transport:
19 | #debug.transport=dt_socket
20 | debug.classpath=\
21 | ${run.classpath}
22 | debug.modulepath=\
23 | ${run.modulepath}
24 | debug.test.classpath=\
25 | ${run.test.classpath}
26 | debug.test.modulepath=\
27 | ${run.test.modulepath}
28 | # Files in build.classes.dir which should be excluded from distribution jar
29 | dist.archive.excludes=
30 | # This directory is removed when the project is cleaned:
31 | dist.dir=dist
32 | dist.jar=${dist.dir}/TAMS-KP.jar
33 | dist.javadoc.dir=${dist.dir}/javadoc
34 | dist.jlink.dir=${dist.dir}/jlink
35 | dist.jlink.output=${dist.jlink.dir}/TAMS-KP
36 | endorsed.classpath=
37 | excludes=
38 | file.reference.jcalendar-1.4.jar=../../../Downloads/jcalendar-1.4/lib/jcalendar-1.4.jar
39 | file.reference.jcalendar-1.4.jar-1=../../Downloads/jcalendar-1.4/lib/jcalendar-1.4.jar
40 | file.reference.jdatepicker-1.3.4.jar=..\\..\\..\\Desktop\\jdatepicker-1.3.4.jar
41 | file.reference.jdatepicker-1.3.4.jar-1=..\\jdatepicker-1.3.4.jar
42 | file.reference.mysql-connector-java-8.0.17.jar=..\\..\\..\\Desktop\\mysql-connector-java-8.0.17\\mysql-connector-java-8.0.17.jar
43 | file.reference.mysql-connector-java-8.0.17.jar-1=C:\\mysql-connector-java-8.0.17\\mysql-connector-java-8.0.17.jar
44 | file.reference.mysql-connector-java-8.0.17.jar-2=..\\mysql-connector-java-8.0.17\\mysql-connector-java-8.0.17.jar
45 | file.reference.rs2xml.jar=..\\..\\..\\Downloads\\rs2xml\\rs2xml.jar
46 | file.reference.rs2xml.jar-1=C:\\rs2xml\\rs2xml.jar
47 | file.reference.rs2xml.jar-2=..\\..\\Downloads\\rs2xml\\rs2xml.jar
48 | file.reference.swingx-all-1.6.4.jar=C:\\Program Files\\NetBeans 8.2\\ide\\modules\\ext\\swingx-all-1.6.4.jar
49 | file.reference.swingx-all-1.6.4.jar-1=C:\\Program Files\\NetBeans-11.1\\netbeans\\ide\\modules\\ext\\swingx-all-1.6.4.jar
50 | includes=**
51 | jar.compress=false
52 | javac.classpath=\
53 | ${file.reference.mysql-connector-java-8.0.17.jar}:\
54 | ${file.reference.jdatepicker-1.3.4.jar}:\
55 | ${file.reference.jcalendar-1.4.jar}:\
56 | ${file.reference.rs2xml.jar}:\
57 | ${file.reference.rs2xml.jar-1}:\
58 | ${file.reference.mysql-connector-java-8.0.17.jar-1}:\
59 | ${file.reference.swingx-all-1.6.4.jar}:\
60 | ${file.reference.rs2xml.jar-2}:\
61 | ${file.reference.jdatepicker-1.3.4.jar-1}:\
62 | ${file.reference.mysql-connector-java-8.0.17.jar-2}:\
63 | ${file.reference.swingx-all-1.6.4.jar-1}:\
64 | ${libs.absolutelayout.classpath}:\
65 | ${file.reference.jcalendar-1.4.jar-1}
66 | # Space-separated list of extra javac options
67 | javac.compilerargs=
68 | javac.deprecation=false
69 | javac.external.vm=true
70 | javac.modulepath=
71 | javac.processormodulepath=
72 | javac.processorpath=\
73 | ${javac.classpath}
74 | javac.source=13
75 | javac.target=13
76 | javac.test.classpath=\
77 | ${javac.classpath}:\
78 | ${build.classes.dir}
79 | javac.test.modulepath=\
80 | ${javac.modulepath}
81 | javac.test.processorpath=\
82 | ${javac.test.classpath}
83 | javadoc.additionalparam=
84 | javadoc.author=false
85 | javadoc.encoding=${source.encoding}
86 | javadoc.html5=false
87 | javadoc.noindex=false
88 | javadoc.nonavbar=false
89 | javadoc.notree=false
90 | javadoc.private=false
91 | javadoc.splitindex=true
92 | javadoc.use=true
93 | javadoc.version=false
94 | javadoc.windowtitle=
95 | # The jlink additional root modules to resolve
96 | jlink.additionalmodules=
97 | # The jlink additional command line parameters
98 | jlink.additionalparam=
99 | jlink.launcher=true
100 | jlink.launcher.name=TAMS-KP
101 | main.class=TAMS.Login
102 | manifest.file=manifest.mf
103 | meta.inf.dir=${src.dir}/META-INF
104 | mkdist.disabled=false
105 | platform.active=default_platform
106 | run.classpath=\
107 | ${javac.classpath}:\
108 | ${build.classes.dir}
109 | # Space-separated list of JVM arguments used when running the project.
110 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
111 | # To set system properties for unit tests define test-sys-prop.name=value:
112 | run.jvmargs=
113 | run.modulepath=\
114 | ${javac.modulepath}
115 | run.test.classpath=\
116 | ${javac.test.classpath}:\
117 | ${build.test.classes.dir}
118 | run.test.modulepath=\
119 | ${javac.test.modulepath}
120 | source.encoding=UTF-8
121 | src.dir=src
122 | test.src.dir=test
123 |
--------------------------------------------------------------------------------
/TAMS.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 8.0.17, for Win64 (x86_64)
2 | --
3 | -- Host: 127.0.0.1 Database: testdb
4 | -- ------------------------------------------------------
5 | -- Server version 8.0.17
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!50503 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `booked_for`
20 | --
21 |
22 | DROP TABLE IF EXISTS `booked_for`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!50503 SET character_set_client = utf8mb4 */;
25 | CREATE TABLE `booked_for` (
26 | `VID` int(11) NOT NULL,
27 | `CID` int(11) NOT NULL,
28 | `TID` int(11) NOT NULL,
29 | `BDATE` date DEFAULT NULL,
30 | PRIMARY KEY (`VID`,`CID`,`TID`),
31 | KEY `cfk_tid1_idx` (`TID`),
32 | KEY `cfk_cid1_idx` (`CID`),
33 | CONSTRAINT `cfk_cid1` FOREIGN KEY (`CID`) REFERENCES `customer` (`cid`) ON DELETE CASCADE ON UPDATE RESTRICT,
34 | CONSTRAINT `cfk_tid1` FOREIGN KEY (`TID`) REFERENCES `trip` (`tid`) ON DELETE CASCADE ON UPDATE RESTRICT,
35 | CONSTRAINT `cfk_vid1` FOREIGN KEY (`VID`) REFERENCES `vechicle` (`vid`) ON DELETE CASCADE ON UPDATE RESTRICT
36 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
37 | /*!40101 SET character_set_client = @saved_cs_client */;
38 |
39 | --
40 | -- Table structure for table `customer`
41 | --
42 |
43 | DROP TABLE IF EXISTS `customer`;
44 | /*!40101 SET @saved_cs_client = @@character_set_client */;
45 | /*!50503 SET character_set_client = utf8mb4 */;
46 | CREATE TABLE `customer` (
47 | `cid` int(11) NOT NULL,
48 | `cname` varchar(45) DEFAULT NULL,
49 | `caddress` varchar(45) DEFAULT NULL,
50 | `cphone` varchar(20) DEFAULT NULL,
51 | PRIMARY KEY (`cid`)
52 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
53 | /*!40101 SET character_set_client = @saved_cs_client */;
54 |
55 | --
56 | -- Table structure for table `driven_by`
57 | --
58 |
59 | DROP TABLE IF EXISTS `driven_by`;
60 | /*!40101 SET @saved_cs_client = @@character_set_client */;
61 | /*!50503 SET character_set_client = utf8mb4 */;
62 | CREATE TABLE `driven_by` (
63 | `VID` int(11) NOT NULL,
64 | `EID` int(11) NOT NULL,
65 | `TID` int(11) NOT NULL,
66 | `DDATE` date DEFAULT NULL,
67 | PRIMARY KEY (`VID`,`EID`,`TID`),
68 | KEY `cfk_eid1_idx` (`EID`),
69 | KEY `cfk_tid2_idx` (`TID`),
70 | CONSTRAINT `cfk_eid1` FOREIGN KEY (`EID`) REFERENCES `employee` (`eid`) ON DELETE CASCADE ON UPDATE CASCADE,
71 | CONSTRAINT `cfk_tid2` FOREIGN KEY (`TID`) REFERENCES `trip` (`tid`) ON DELETE CASCADE ON UPDATE CASCADE,
72 | CONSTRAINT `cfk_vid2` FOREIGN KEY (`VID`) REFERENCES `vechicle` (`vid`) ON DELETE CASCADE ON UPDATE CASCADE
73 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
74 | /*!40101 SET character_set_client = @saved_cs_client */;
75 |
76 | --
77 | -- Table structure for table `employee`
78 | --
79 |
80 | DROP TABLE IF EXISTS `employee`;
81 | /*!40101 SET @saved_cs_client = @@character_set_client */;
82 | /*!50503 SET character_set_client = utf8mb4 */;
83 | CREATE TABLE `employee` (
84 | `eid` int(11) NOT NULL AUTO_INCREMENT,
85 | `ename` varchar(45) NOT NULL,
86 | `ephone` varchar(20) NOT NULL,
87 | `eaddress` varchar(45) DEFAULT NULL,
88 | `eJdate` date NOT NULL,
89 | PRIMARY KEY (`eid`),
90 | UNIQUE KEY `eid_UNIQUE` (`eid`),
91 | CONSTRAINT `du_che_con` CHECK (((`ejdate` >= _utf8mb4'1990-01-01') and (`ejdate` <= _utf8mb4'2019-12-25')))
92 | ) ENGINE=InnoDB AUTO_INCREMENT=98 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT;
93 | /*!40101 SET character_set_client = @saved_cs_client */;
94 |
95 | --
96 | -- Table structure for table `login`
97 | --
98 |
99 | DROP TABLE IF EXISTS `login`;
100 | /*!40101 SET @saved_cs_client = @@character_set_client */;
101 | /*!50503 SET character_set_client = utf8mb4 */;
102 | CREATE TABLE `login` (
103 | `username` varchar(45) NOT NULL,
104 | `password` varchar(45) NOT NULL,
105 | PRIMARY KEY (`password`,`username`)
106 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
107 | /*!40101 SET character_set_client = @saved_cs_client */;
108 |
109 | --
110 | -- Table structure for table `payment`
111 | --
112 |
113 | DROP TABLE IF EXISTS `payment`;
114 | /*!40101 SET @saved_cs_client = @@character_set_client */;
115 | /*!50503 SET character_set_client = utf8mb4 */;
116 | CREATE TABLE `payment` (
117 | `TID` int(11) NOT NULL,
118 | `CID` int(11) NOT NULL,
119 | `DISTANCETRAVEL` varchar(45) DEFAULT NULL,
120 | `AMOUNT` varchar(45) DEFAULT NULL,
121 | `PDATE` date DEFAULT NULL,
122 | PRIMARY KEY (`TID`,`CID`),
123 | KEY `cfk_cid_idx` (`CID`),
124 | CONSTRAINT `cfk_cid` FOREIGN KEY (`CID`) REFERENCES `customer` (`cid`) ON DELETE CASCADE ON UPDATE CASCADE,
125 | CONSTRAINT `cfk_tid` FOREIGN KEY (`TID`) REFERENCES `trip` (`tid`) ON DELETE CASCADE ON UPDATE CASCADE
126 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
127 |
128 | /*!40101 SET character_set_client = @saved_cs_client */;
129 |
130 | --
131 | -- Table structure for table `places`
132 | --
133 |
134 | DROP TABLE IF EXISTS `places`;
135 | /*!40101 SET @saved_cs_client = @@character_set_client */;
136 | /*!50503 SET character_set_client = utf8mb4 */;
137 | CREATE TABLE `places` (
138 | `idplaces` int(11) NOT NULL,
139 | `city` varchar(45) NOT NULL,
140 | `distance` varchar(45) NOT NULL
141 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
142 | /*!40101 SET character_set_client = @saved_cs_client */;
143 |
144 | --
145 | -- Table structure for table `trip`
146 | --
147 |
148 | DROP TABLE IF EXISTS `trip`;
149 | /*!40101 SET @saved_cs_client = @@character_set_client */;
150 | /*!50503 SET character_set_client = utf8mb4 */;
151 | CREATE TABLE `trip` (
152 | `tid` int(11) NOT NULL,
153 | `source` varchar(45) DEFAULT NULL,
154 | `dest` varchar(45) DEFAULT NULL,
155 | `sdate` date DEFAULT NULL,
156 | `edate` date DEFAULT NULL,
157 | PRIMARY KEY (`tid`),
158 | CONSTRAINT `dateconstraint` CHECK (((`sdate` >= sysdate()) and (`sdate` <= _utf8mb4'2025-12-30'))),
159 | CONSTRAINT `dateconstraintsdb` CHECK (((`edate` >= `sdate`) and (`edate` <= _utf8mb4'2025-12-30')))
160 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
161 | /*!40101 SET character_set_client = @saved_cs_client */;
162 |
163 | --
164 | -- Table structure for table `vechicle`
165 | --
166 |
167 | DROP TABLE IF EXISTS `vechicle`;
168 | /*!40101 SET @saved_cs_client = @@character_set_client */;
169 | /*!50503 SET character_set_client = utf8mb4 */;
170 | CREATE TABLE `vechicle` (
171 | `vid` int(11) NOT NULL AUTO_INCREMENT,
172 | `vname` varchar(50) DEFAULT NULL,
173 | `capacity` int(11) DEFAULT NULL,
174 | `vtype` varchar(50) DEFAULT NULL,
175 | `regno` varchar(50) DEFAULT NULL,
176 | PRIMARY KEY (`vid`),
177 | CONSTRAINT `cap` CHECK ((`capacity` < 60))
178 | ) ENGINE=InnoDB AUTO_INCREMENT=4473 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
179 | /*!40101 SET character_set_client = @saved_cs_client */;
180 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
181 |
182 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
183 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
184 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
185 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
186 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
187 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
188 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
189 |
190 | -- Dump completed on 2020-11-09 20:49:01
191 |
--------------------------------------------------------------------------------
/src/TAMS/Login.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
189 |
--------------------------------------------------------------------------------
/src/TAMS/Login.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package TAMS;
7 |
8 | import java.sql.Connection;
9 | import java.sql.PreparedStatement;
10 | import java.sql.ResultSet;
11 | import javax.swing.JOptionPane;
12 |
13 | /**
14 | *
15 | * @author HP
16 | */
17 | public class Login extends javax.swing.JFrame {
18 |
19 | /**
20 | * Creates new form Login
21 | */
22 | public Login() {
23 | initComponents();
24 | }
25 |
26 | Connection conn=null;
27 | PreparedStatement pst=null;
28 | ResultSet rs=null;
29 |
30 | /**
31 | * This method is called from within the constructor to initialize the form.
32 | * WARNING: Do NOT modify this code. The content of this method is always
33 | * regenerated by the Form Editor.
34 | */
35 | @SuppressWarnings("unchecked")
36 | // //GEN-BEGIN:initComponents
37 | private void initComponents() {
38 |
39 | jPanel1 = new javax.swing.JPanel();
40 | user = new javax.swing.JLabel();
41 | username = new javax.swing.JTextField();
42 | jLabel2 = new javax.swing.JLabel();
43 | Login = new javax.swing.JButton();
44 | header = new javax.swing.JPanel();
45 | jLabel11 = new javax.swing.JLabel();
46 | password = new javax.swing.JTextField();
47 |
48 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
49 | setBackground(new java.awt.Color(0, 0, 51));
50 |
51 | jPanel1.setBackground(new java.awt.Color(0, 0, 51));
52 | jPanel1.setForeground(new java.awt.Color(0, 0, 51));
53 |
54 | user.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
55 | user.setForeground(new java.awt.Color(255, 255, 255));
56 | user.setText("USERNAME");
57 |
58 | username.addActionListener(new java.awt.event.ActionListener() {
59 | public void actionPerformed(java.awt.event.ActionEvent evt) {
60 | usernameActionPerformed(evt);
61 | }
62 | });
63 |
64 | jLabel2.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
65 | jLabel2.setForeground(new java.awt.Color(255, 255, 255));
66 | jLabel2.setText("PASSWORD");
67 |
68 | Login.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N
69 | Login.setText("LOGIN");
70 | Login.addActionListener(new java.awt.event.ActionListener() {
71 | public void actionPerformed(java.awt.event.ActionEvent evt) {
72 | LoginActionPerformed(evt);
73 | }
74 | });
75 |
76 | header.setBackground(new java.awt.Color(102, 0, 153));
77 | header.addMouseListener(new java.awt.event.MouseAdapter() {
78 | public void mouseClicked(java.awt.event.MouseEvent evt) {
79 | headerMouseClicked(evt);
80 | }
81 | });
82 |
83 | jLabel11.setFont(new java.awt.Font("Segoe UI", 1, 22)); // NOI18N
84 | jLabel11.setForeground(new java.awt.Color(255, 255, 255));
85 | jLabel11.setText("LOGIN");
86 |
87 | javax.swing.GroupLayout headerLayout = new javax.swing.GroupLayout(header);
88 | header.setLayout(headerLayout);
89 | headerLayout.setHorizontalGroup(
90 | headerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
91 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, headerLayout.createSequentialGroup()
92 | .addContainerGap(261, Short.MAX_VALUE)
93 | .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 274, javax.swing.GroupLayout.PREFERRED_SIZE)
94 | .addGap(104, 104, 104))
95 | );
96 | headerLayout.setVerticalGroup(
97 | headerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
98 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, headerLayout.createSequentialGroup()
99 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
100 | .addComponent(jLabel11)
101 | .addContainerGap())
102 | );
103 |
104 | password.addActionListener(new java.awt.event.ActionListener() {
105 | public void actionPerformed(java.awt.event.ActionEvent evt) {
106 | passwordActionPerformed(evt);
107 | }
108 | });
109 |
110 | javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
111 | jPanel1.setLayout(jPanel1Layout);
112 | jPanel1Layout.setHorizontalGroup(
113 | jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
114 | .addGroup(jPanel1Layout.createSequentialGroup()
115 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
116 | .addGroup(jPanel1Layout.createSequentialGroup()
117 | .addGap(139, 139, 139)
118 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
119 | .addComponent(user)
120 | .addComponent(jLabel2))
121 | .addGap(65, 65, 65)
122 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
123 | .addComponent(username)
124 | .addComponent(password, javax.swing.GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE)))
125 | .addGroup(jPanel1Layout.createSequentialGroup()
126 | .addGap(267, 267, 267)
127 | .addComponent(Login)))
128 | .addContainerGap(89, Short.MAX_VALUE))
129 | .addComponent(header, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
130 | );
131 | jPanel1Layout.setVerticalGroup(
132 | jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
133 | .addGroup(jPanel1Layout.createSequentialGroup()
134 | .addComponent(header, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
135 | .addGap(86, 86, 86)
136 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
137 | .addComponent(username, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
138 | .addComponent(user))
139 | .addGap(48, 48, 48)
140 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
141 | .addComponent(jLabel2)
142 | .addComponent(password, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
143 | .addGap(68, 68, 68)
144 | .addComponent(Login)
145 | .addContainerGap(97, Short.MAX_VALUE))
146 | );
147 |
148 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
149 | getContentPane().setLayout(layout);
150 | layout.setHorizontalGroup(
151 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
152 | .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
153 | );
154 | layout.setVerticalGroup(
155 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
156 | .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
157 | );
158 |
159 | pack();
160 | }// //GEN-END:initComponents
161 |
162 | private void LoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LoginActionPerformed
163 | // TODO add your handling code here:
164 |
165 |
166 | conn = Mysqlconnect.ConnectDB();
167 |
168 | String String = "Select * from login where username=? and password=?";
169 | try{
170 | pst=conn.prepareStatement(String);
171 | pst.setString(1,username.getText());
172 | pst.setString(2,password.getText());
173 | rs=pst.executeQuery();
174 |
175 | if(rs.next()){
176 | JOptionPane.showMessageDialog(null,"Login Succesfull");
177 | Home Hobj= new Home();
178 | Hobj.setVisible(true);
179 | dispose();
180 | }
181 |
182 | else{
183 | JOptionPane.showMessageDialog(null, "invalid username and password","access denied",JOptionPane.ERROR_MESSAGE);
184 | }
185 |
186 |
187 | }
188 | catch (Exception e){
189 | JOptionPane.showMessageDialog(null, e);
190 | }
191 |
192 |
193 | }//GEN-LAST:event_LoginActionPerformed
194 |
195 | private void headerMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_headerMouseClicked
196 | // TODO add your handling code here:
197 | dispose();
198 | Home Hobj = new Home();
199 | Hobj.setVisible(true);
200 | }//GEN-LAST:event_headerMouseClicked
201 |
202 | private void usernameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_usernameActionPerformed
203 | // TODO add your handling code here:
204 | }//GEN-LAST:event_usernameActionPerformed
205 |
206 | private void passwordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_passwordActionPerformed
207 | // TODO add your handling code here:
208 | }//GEN-LAST:event_passwordActionPerformed
209 |
210 | /**
211 | * @param args the command line arguments
212 | */
213 | public static void main(String args[]) {
214 | /* Set the Nimbus look and feel */
215 | //
216 | /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
217 | * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
218 | */
219 | try {
220 | for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
221 | if ("Nimbus".equals(info.getName())) {
222 | javax.swing.UIManager.setLookAndFeel(info.getClassName());
223 | break;
224 | }
225 | }
226 | } catch (ClassNotFoundException ex) {
227 | java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
228 | } catch (InstantiationException ex) {
229 | java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
230 | } catch (IllegalAccessException ex) {
231 | java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
232 | } catch (javax.swing.UnsupportedLookAndFeelException ex) {
233 | java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
234 | }
235 | //
236 |
237 | /* Create and display the form */
238 | java.awt.EventQueue.invokeLater(new Runnable() {
239 | public void run() {
240 | new Login().setVisible(true);
241 | }
242 | });
243 | }
244 |
245 | // Variables declaration - do not modify//GEN-BEGIN:variables
246 | private javax.swing.JButton Login;
247 | private javax.swing.JPanel header;
248 | private javax.swing.JLabel jLabel11;
249 | private javax.swing.JLabel jLabel2;
250 | private javax.swing.JPanel jPanel1;
251 | private javax.swing.JTextField password;
252 | private javax.swing.JLabel user;
253 | private javax.swing.JTextField username;
254 | // End of variables declaration//GEN-END:variables
255 | }
256 |
--------------------------------------------------------------------------------
/src/TAMS/Home.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
329 |
--------------------------------------------------------------------------------
/src/TAMS/Home.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package TAMS;
7 |
8 | import java.awt.Color;
9 | import java.awt.Toolkit;
10 | import java.awt.event.WindowEvent;
11 | import java.sql.Connection;
12 | import java.sql.PreparedStatement;
13 | import java.sql.ResultSet;
14 | import javax.swing.JOptionPane;
15 | import javax.swing.JPanel;
16 | import net.proteanit.sql.DbUtils;
17 |
18 | /**
19 | *
20 | * @author HP
21 | */
22 | public class Home extends javax.swing.JFrame {
23 |
24 | /**
25 | * Creates new form Home
26 | */
27 | public Home() {
28 | initComponents();
29 | }
30 |
31 | Connection conn=null;
32 | PreparedStatement pst=null;
33 | ResultSet rs=null;
34 |
35 | public void close(){
36 |
37 | WindowEvent winClosingEvent = new WindowEvent(this,WindowEvent.WINDOW_CLOSING);
38 | Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(winClosingEvent);
39 |
40 | }
41 |
42 | /**
43 | * This method is called from within the constructor to initialize the form.
44 | * WARNING: Do NOT modify this code. The content of this method is always
45 | * regenerated by the Form Editor.
46 | */
47 | @SuppressWarnings("unchecked")
48 | // //GEN-BEGIN:initComponents
49 | private void initComponents() {
50 |
51 | bg = new javax.swing.JPanel();
52 | sidePanel = new javax.swing.JPanel();
53 | jPanel2 = new javax.swing.JPanel();
54 | Home = new javax.swing.JLabel();
55 | jPanel3 = new javax.swing.JPanel();
56 | Vechicle = new javax.swing.JLabel();
57 | jPanel4 = new javax.swing.JPanel();
58 | Employee = new javax.swing.JLabel();
59 | jPanel5 = new javax.swing.JPanel();
60 | Booktrip = new javax.swing.JLabel();
61 | jLabel1 = new javax.swing.JLabel();
62 |
63 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
64 |
65 | bg.setPreferredSize(new java.awt.Dimension(6265, 535));
66 |
67 | sidePanel.setBackground(new java.awt.Color(0, 0, 51));
68 | sidePanel.setForeground(new java.awt.Color(255, 255, 255));
69 |
70 | jPanel2.setBackground(new java.awt.Color(0, 0, 51));
71 | jPanel2.addMouseListener(new java.awt.event.MouseAdapter() {
72 | public void mouseClicked(java.awt.event.MouseEvent evt) {
73 | jPanel2MouseClicked(evt);
74 | }
75 | });
76 |
77 | Home.setFont(new java.awt.Font("Segoe UI", 1, 24)); // NOI18N
78 | Home.setForeground(new java.awt.Color(255, 255, 255));
79 | Home.setText("Home");
80 | Home.addMouseListener(new java.awt.event.MouseAdapter() {
81 | public void mouseEntered(java.awt.event.MouseEvent evt) {
82 | HomeMouseEntered(evt);
83 | }
84 | public void mouseExited(java.awt.event.MouseEvent evt) {
85 | HomeMouseExited(evt);
86 | }
87 | });
88 |
89 | javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
90 | jPanel2.setLayout(jPanel2Layout);
91 | jPanel2Layout.setHorizontalGroup(
92 | jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
93 | .addGroup(jPanel2Layout.createSequentialGroup()
94 | .addGap(45, 45, 45)
95 | .addComponent(Home, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
96 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
97 | );
98 | jPanel2Layout.setVerticalGroup(
99 | jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
100 | .addGroup(jPanel2Layout.createSequentialGroup()
101 | .addContainerGap()
102 | .addComponent(Home, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
103 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
104 | );
105 |
106 | jPanel3.setBackground(new java.awt.Color(0, 0, 51));
107 |
108 | Vechicle.setFont(new java.awt.Font("Segoe UI", 1, 24)); // NOI18N
109 | Vechicle.setForeground(new java.awt.Color(255, 255, 255));
110 | Vechicle.setText("Vechicle");
111 | Vechicle.addMouseListener(new java.awt.event.MouseAdapter() {
112 | public void mouseClicked(java.awt.event.MouseEvent evt) {
113 | VechicleMouseClicked(evt);
114 | }
115 | public void mouseEntered(java.awt.event.MouseEvent evt) {
116 | VechicleMouseEntered(evt);
117 | }
118 | public void mouseExited(java.awt.event.MouseEvent evt) {
119 | VechicleMouseExited(evt);
120 | }
121 | });
122 |
123 | javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
124 | jPanel3.setLayout(jPanel3Layout);
125 | jPanel3Layout.setHorizontalGroup(
126 | jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
127 | .addGroup(jPanel3Layout.createSequentialGroup()
128 | .addGap(41, 41, 41)
129 | .addComponent(Vechicle, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
130 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
131 | );
132 | jPanel3Layout.setVerticalGroup(
133 | jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
134 | .addGroup(jPanel3Layout.createSequentialGroup()
135 | .addComponent(Vechicle, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
136 | .addGap(0, 10, Short.MAX_VALUE))
137 | );
138 |
139 | jPanel4.setBackground(new java.awt.Color(0, 0, 51));
140 |
141 | Employee.setFont(new java.awt.Font("Segoe UI", 1, 24)); // NOI18N
142 | Employee.setForeground(new java.awt.Color(255, 255, 255));
143 | Employee.setText("Employee");
144 | Employee.addMouseListener(new java.awt.event.MouseAdapter() {
145 | public void mouseClicked(java.awt.event.MouseEvent evt) {
146 | EmployeeMouseClicked(evt);
147 | }
148 | public void mouseEntered(java.awt.event.MouseEvent evt) {
149 | EmployeeMouseEntered(evt);
150 | }
151 | public void mouseExited(java.awt.event.MouseEvent evt) {
152 | EmployeeMouseExited(evt);
153 | }
154 | });
155 |
156 | javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
157 | jPanel4.setLayout(jPanel4Layout);
158 | jPanel4Layout.setHorizontalGroup(
159 | jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
160 | .addGroup(jPanel4Layout.createSequentialGroup()
161 | .addGap(31, 31, 31)
162 | .addComponent(Employee, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
163 | .addContainerGap(123, Short.MAX_VALUE))
164 | );
165 | jPanel4Layout.setVerticalGroup(
166 | jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
167 | .addGroup(jPanel4Layout.createSequentialGroup()
168 | .addComponent(Employee, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
169 | .addGap(0, 14, Short.MAX_VALUE))
170 | );
171 |
172 | jPanel5.setBackground(new java.awt.Color(0, 0, 51));
173 | jPanel5.addMouseListener(new java.awt.event.MouseAdapter() {
174 | public void mouseEntered(java.awt.event.MouseEvent evt) {
175 | jPanel5MouseEntered(evt);
176 | }
177 | public void mouseExited(java.awt.event.MouseEvent evt) {
178 | jPanel5MouseExited(evt);
179 | }
180 | });
181 |
182 | Booktrip.setFont(new java.awt.Font("Segoe UI", 1, 24)); // NOI18N
183 | Booktrip.setForeground(new java.awt.Color(255, 255, 255));
184 | Booktrip.setText("Book Trip");
185 | Booktrip.addMouseListener(new java.awt.event.MouseAdapter() {
186 | public void mouseClicked(java.awt.event.MouseEvent evt) {
187 | BooktripMouseClicked(evt);
188 | }
189 | public void mouseEntered(java.awt.event.MouseEvent evt) {
190 | BooktripMouseEntered(evt);
191 | }
192 | public void mouseExited(java.awt.event.MouseEvent evt) {
193 | BooktripMouseExited(evt);
194 | }
195 | });
196 |
197 | javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
198 | jPanel5.setLayout(jPanel5Layout);
199 | jPanel5Layout.setHorizontalGroup(
200 | jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
201 | .addGroup(jPanel5Layout.createSequentialGroup()
202 | .addGap(32, 32, 32)
203 | .addComponent(Booktrip, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE)
204 | .addContainerGap(115, Short.MAX_VALUE))
205 | );
206 | jPanel5Layout.setVerticalGroup(
207 | jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
208 | .addGroup(jPanel5Layout.createSequentialGroup()
209 | .addContainerGap()
210 | .addComponent(Booktrip, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
211 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
212 | );
213 |
214 | javax.swing.GroupLayout sidePanelLayout = new javax.swing.GroupLayout(sidePanel);
215 | sidePanel.setLayout(sidePanelLayout);
216 | sidePanelLayout.setHorizontalGroup(
217 | sidePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
218 | .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
219 | .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
220 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, sidePanelLayout.createSequentialGroup()
221 | .addContainerGap()
222 | .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
223 | .addContainerGap())
224 | .addGroup(sidePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
225 | .addGroup(sidePanelLayout.createSequentialGroup()
226 | .addContainerGap()
227 | .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
228 | .addContainerGap()))
229 | );
230 | sidePanelLayout.setVerticalGroup(
231 | sidePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
232 | .addGroup(sidePanelLayout.createSequentialGroup()
233 | .addGap(102, 102, 102)
234 | .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
235 | .addGap(120, 120, 120)
236 | .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
237 | .addGap(38, 38, 38)
238 | .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
239 | .addContainerGap(3808, Short.MAX_VALUE))
240 | .addGroup(sidePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
241 | .addGroup(sidePanelLayout.createSequentialGroup()
242 | .addGap(182, 182, 182)
243 | .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
244 | .addContainerGap(3974, Short.MAX_VALUE)))
245 | );
246 |
247 | jLabel1.setFont(new java.awt.Font("Segoe UI", 1, 36)); // NOI18N
248 | jLabel1.setText("Travel Agency Management System");
249 |
250 | javax.swing.GroupLayout bgLayout = new javax.swing.GroupLayout(bg);
251 | bg.setLayout(bgLayout);
252 | bgLayout.setHorizontalGroup(
253 | bgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
254 | .addGroup(bgLayout.createSequentialGroup()
255 | .addComponent(sidePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
256 | .addGap(163, 163, 163)
257 | .addComponent(jLabel1)
258 | .addContainerGap(3008, Short.MAX_VALUE))
259 | );
260 | bgLayout.setVerticalGroup(
261 | bgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
262 | .addGroup(bgLayout.createSequentialGroup()
263 | .addGroup(bgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
264 | .addComponent(sidePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
265 | .addGroup(bgLayout.createSequentialGroup()
266 | .addGap(225, 225, 225)
267 | .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)))
268 | .addContainerGap())
269 | );
270 |
271 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
272 | getContentPane().setLayout(layout);
273 | layout.setHorizontalGroup(
274 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
275 | .addGroup(layout.createSequentialGroup()
276 | .addComponent(bg, javax.swing.GroupLayout.PREFERRED_SIZE, 4088, javax.swing.GroupLayout.PREFERRED_SIZE)
277 | .addGap(0, 842, Short.MAX_VALUE))
278 | );
279 | layout.setVerticalGroup(
280 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
281 | .addGroup(layout.createSequentialGroup()
282 | .addComponent(bg, javax.swing.GroupLayout.PREFERRED_SIZE, 3652, javax.swing.GroupLayout.PREFERRED_SIZE)
283 | .addGap(0, 429, Short.MAX_VALUE))
284 | );
285 |
286 | pack();
287 | }// //GEN-END:initComponents
288 |
289 | private void BooktripMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_BooktripMouseClicked
290 | // TODO add your handling code here:
291 | dispose(); // TO CLOSE PREVIOUS WINDOWS
292 | Book_Trip Btobj = new Book_Trip();
293 | Btobj.setVisible(true);
294 | }//GEN-LAST:event_BooktripMouseClicked
295 |
296 | private void VechicleMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_VechicleMouseClicked
297 | // TODO add your handling code here:
298 |
299 | Vechicle Vobj = new Vechicle();
300 | Vobj.setVisible(true);
301 | dispose();
302 | //
303 | }//GEN-LAST:event_VechicleMouseClicked
304 |
305 | private void EmployeeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_EmployeeMouseClicked
306 | // TODO add your handling code here:
307 | dispose();
308 | Employee Eobj = new Employee();
309 | Eobj.setVisible(true);
310 |
311 | }//GEN-LAST:event_EmployeeMouseClicked
312 |
313 | public void setColor(JPanel p){
314 | p.setBackground(new Color(102,0,153));
315 | }
316 |
317 | public void resetColor(JPanel p){
318 | p.setBackground(new Color(0,0,51));
319 | }
320 |
321 | private void jPanel5MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel5MouseEntered
322 | // TODO add your handling code here:
323 | setColor(jPanel5);
324 | }//GEN-LAST:event_jPanel5MouseEntered
325 |
326 | private void jPanel5MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel5MouseExited
327 | // TODO add your handling code here:
328 | resetColor(jPanel5);
329 | }//GEN-LAST:event_jPanel5MouseExited
330 |
331 | private void BooktripMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_BooktripMouseEntered
332 | // TODO add your handling code here:
333 | setColor(jPanel5);
334 | }//GEN-LAST:event_BooktripMouseEntered
335 |
336 | private void BooktripMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_BooktripMouseExited
337 | // TODO add your handling code here:
338 | resetColor(jPanel5);
339 | }//GEN-LAST:event_BooktripMouseExited
340 |
341 | private void HomeMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_HomeMouseEntered
342 | // TODO add your handling code here:
343 | setColor(jPanel2);
344 | }//GEN-LAST:event_HomeMouseEntered
345 |
346 | private void HomeMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_HomeMouseExited
347 | // TODO add your handling code here:
348 | resetColor(jPanel2);
349 | }//GEN-LAST:event_HomeMouseExited
350 |
351 | private void VechicleMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_VechicleMouseEntered
352 | // TODO add your handling code here:
353 | setColor(jPanel3);
354 | }//GEN-LAST:event_VechicleMouseEntered
355 |
356 | private void VechicleMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_VechicleMouseExited
357 | // TODO add your handling code here:
358 | resetColor(jPanel3);
359 | }//GEN-LAST:event_VechicleMouseExited
360 |
361 | private void EmployeeMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_EmployeeMouseEntered
362 | // TODO add your handling code here:
363 | setColor(jPanel4);
364 |
365 | }//GEN-LAST:event_EmployeeMouseEntered
366 |
367 | private void EmployeeMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_EmployeeMouseExited
368 | // TODO add your handling code here:
369 | resetColor(jPanel4);
370 | }//GEN-LAST:event_EmployeeMouseExited
371 |
372 | private void jPanel2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel2MouseClicked
373 | // TODO add your handling code here:
374 | Login Lobj = new Login();
375 | Lobj.setVisible(true);
376 | dispose();
377 | }//GEN-LAST:event_jPanel2MouseClicked
378 |
379 | /**
380 | * @param args the command line arguments
381 | */
382 | public static void main(String args[]) {
383 | /* Set the Nimbus look and feel */
384 | //
385 | /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
386 | * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
387 | */
388 | try {
389 | for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
390 | if ("Nimbus".equals(info.getName())) {
391 | javax.swing.UIManager.setLookAndFeel(info.getClassName());
392 | break;
393 | }
394 | }
395 | } catch (ClassNotFoundException ex) {
396 | java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
397 | } catch (InstantiationException ex) {
398 | java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
399 | } catch (IllegalAccessException ex) {
400 | java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
401 | } catch (javax.swing.UnsupportedLookAndFeelException ex) {
402 | java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
403 | }
404 | //
405 |
406 | /* Create and display the form */
407 | java.awt.EventQueue.invokeLater(new Runnable() {
408 | public void run() {
409 | new Home().setVisible(true);
410 | }
411 | });
412 | }
413 |
414 | // Variables declaration - do not modify//GEN-BEGIN:variables
415 | private javax.swing.JLabel Booktrip;
416 | private javax.swing.JLabel Employee;
417 | private javax.swing.JLabel Home;
418 | private javax.swing.JLabel Vechicle;
419 | private javax.swing.JPanel bg;
420 | private javax.swing.JLabel jLabel1;
421 | private javax.swing.JPanel jPanel2;
422 | private javax.swing.JPanel jPanel3;
423 | private javax.swing.JPanel jPanel4;
424 | private javax.swing.JPanel jPanel5;
425 | private javax.swing.JPanel sidePanel;
426 | // End of variables declaration//GEN-END:variables
427 | }
428 |
--------------------------------------------------------------------------------
/src/TAMS/Employee.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
379 |
--------------------------------------------------------------------------------
/src/TAMS/Employee.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package TAMS;
7 |
8 | import java.sql.Connection;
9 | import java.sql.Time;
10 | import java.sql.PreparedStatement;
11 | import java.sql.ResultSet;
12 | import java.text.ParseException;
13 | import java.text.SimpleDateFormat;
14 | import java.util.Date;
15 | import java.util.logging.Level;
16 | import java.util.logging.Logger;
17 | import javax.swing.JOptionPane;
18 | import javax.swing.table.DefaultTableModel;
19 | import net.proteanit.sql.DbUtils;
20 |
21 | /**
22 | *
23 | * @author HP
24 | */
25 | public class Employee extends javax.swing.JFrame {
26 |
27 | Connection conn=null;
28 | PreparedStatement pst=null;
29 | ResultSet rs=null;
30 |
31 |
32 | /**
33 | * Creates new form Employee
34 | */
35 |
36 | public Employee() {
37 | initComponents();
38 | conn = Mysqlconnect.ConnectDB();
39 | fetch();
40 | }
41 |
42 | public void fetch(){
43 | try{
44 | String sql="select * from employee";
45 | pst=conn.prepareStatement(sql);
46 | rs=pst.executeQuery();
47 | Etable.setModel(DbUtils.resultSetToTableModel(rs));
48 | }
49 |
50 | catch(Exception e){
51 | JOptionPane.showMessageDialog(null,e);
52 |
53 | }
54 | }
55 |
56 | /**
57 | * This method is called from within the constructor to initialize the form.
58 | * WARNING: Do NOT modify this code. The content of this method is always
59 | * regenerated by the Form Editor.
60 | */
61 | @SuppressWarnings("unchecked")
62 | // //GEN-BEGIN:initComponents
63 | private void initComponents() {
64 |
65 | Epane = new javax.swing.JPanel();
66 | header = new javax.swing.JPanel();
67 | jLabel6 = new javax.swing.JLabel();
68 | jLabel1 = new javax.swing.JLabel();
69 | jLabel2 = new javax.swing.JLabel();
70 | jLabel3 = new javax.swing.JLabel();
71 | jLabel4 = new javax.swing.JLabel();
72 | jLabel5 = new javax.swing.JLabel();
73 | Ename = new javax.swing.JTextField();
74 | Ephone = new javax.swing.JTextField();
75 | Eaddress = new javax.swing.JTextField();
76 | Eid = new javax.swing.JTextField();
77 | Addbtn = new javax.swing.JButton();
78 | Modbtn = new javax.swing.JButton();
79 | Delbtn = new javax.swing.JButton();
80 | Clrbtn = new javax.swing.JButton();
81 | Espane = new javax.swing.JScrollPane();
82 | Etable = new javax.swing.JTable();
83 | Ejdate = new org.jdesktop.swingx.JXDatePicker();
84 |
85 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
86 |
87 | Epane.setBackground(new java.awt.Color(0, 0, 51));
88 |
89 | header.setBackground(new java.awt.Color(102, 0, 153));
90 | header.addMouseListener(new java.awt.event.MouseAdapter() {
91 | public void mouseClicked(java.awt.event.MouseEvent evt) {
92 | headerMouseClicked(evt);
93 | }
94 | });
95 |
96 | jLabel6.setFont(new java.awt.Font("Segoe UI", 1, 22)); // NOI18N
97 | jLabel6.setForeground(new java.awt.Color(255, 255, 255));
98 | jLabel6.setText("EMPLOYEE DASHBOARD");
99 |
100 | javax.swing.GroupLayout headerLayout = new javax.swing.GroupLayout(header);
101 | header.setLayout(headerLayout);
102 | headerLayout.setHorizontalGroup(
103 | headerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
104 | .addGroup(headerLayout.createSequentialGroup()
105 | .addGap(295, 295, 295)
106 | .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 274, javax.swing.GroupLayout.PREFERRED_SIZE)
107 | .addContainerGap(232, Short.MAX_VALUE))
108 | );
109 | headerLayout.setVerticalGroup(
110 | headerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
111 | .addGroup(headerLayout.createSequentialGroup()
112 | .addContainerGap()
113 | .addComponent(jLabel6)
114 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
115 | );
116 |
117 | jLabel1.setBackground(new java.awt.Color(255, 255, 255));
118 | jLabel1.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
119 | jLabel1.setForeground(new java.awt.Color(255, 255, 255));
120 | jLabel1.setText("Employee Name ");
121 |
122 | jLabel2.setBackground(new java.awt.Color(255, 255, 255));
123 | jLabel2.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
124 | jLabel2.setForeground(new java.awt.Color(255, 255, 255));
125 | jLabel2.setText("Employee ID ");
126 |
127 | jLabel3.setBackground(new java.awt.Color(255, 255, 255));
128 | jLabel3.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
129 | jLabel3.setForeground(new java.awt.Color(255, 255, 255));
130 | jLabel3.setText("Address");
131 |
132 | jLabel4.setBackground(new java.awt.Color(255, 255, 255));
133 | jLabel4.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
134 | jLabel4.setForeground(new java.awt.Color(255, 255, 255));
135 | jLabel4.setText("Joining Date");
136 |
137 | jLabel5.setBackground(new java.awt.Color(255, 255, 255));
138 | jLabel5.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
139 | jLabel5.setForeground(new java.awt.Color(255, 255, 255));
140 | jLabel5.setText("Phone Number");
141 |
142 | Ename.addActionListener(new java.awt.event.ActionListener() {
143 | public void actionPerformed(java.awt.event.ActionEvent evt) {
144 | EnameActionPerformed(evt);
145 | }
146 | });
147 |
148 | Ephone.addActionListener(new java.awt.event.ActionListener() {
149 | public void actionPerformed(java.awt.event.ActionEvent evt) {
150 | EphoneActionPerformed(evt);
151 | }
152 | });
153 |
154 | Eaddress.addActionListener(new java.awt.event.ActionListener() {
155 | public void actionPerformed(java.awt.event.ActionEvent evt) {
156 | EaddressActionPerformed(evt);
157 | }
158 | });
159 |
160 | Eid.addActionListener(new java.awt.event.ActionListener() {
161 | public void actionPerformed(java.awt.event.ActionEvent evt) {
162 | EidActionPerformed(evt);
163 | }
164 | });
165 |
166 | Addbtn.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
167 | Addbtn.setText("ADD");
168 | Addbtn.addActionListener(new java.awt.event.ActionListener() {
169 | public void actionPerformed(java.awt.event.ActionEvent evt) {
170 | AddbtnActionPerformed(evt);
171 | }
172 | });
173 |
174 | Modbtn.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
175 | Modbtn.setText("MODIFY");
176 | Modbtn.addActionListener(new java.awt.event.ActionListener() {
177 | public void actionPerformed(java.awt.event.ActionEvent evt) {
178 | ModbtnActionPerformed(evt);
179 | }
180 | });
181 |
182 | Delbtn.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
183 | Delbtn.setText("DELETE");
184 | Delbtn.addActionListener(new java.awt.event.ActionListener() {
185 | public void actionPerformed(java.awt.event.ActionEvent evt) {
186 | DelbtnActionPerformed(evt);
187 | }
188 | });
189 |
190 | Clrbtn.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
191 | Clrbtn.setText("CLEAR");
192 | Clrbtn.addActionListener(new java.awt.event.ActionListener() {
193 | public void actionPerformed(java.awt.event.ActionEvent evt) {
194 | ClrbtnActionPerformed(evt);
195 | }
196 | });
197 |
198 | Etable.setModel(new javax.swing.table.DefaultTableModel(
199 | new Object [][] {
200 |
201 | },
202 | new String [] {
203 | "Employee ID", "Employee name ", "Phone", "Address", "Join Date"
204 | }
205 | ));
206 | Etable.addMouseListener(new java.awt.event.MouseAdapter() {
207 | public void mouseClicked(java.awt.event.MouseEvent evt) {
208 | EtableMouseClicked(evt);
209 | }
210 | });
211 | Espane.setViewportView(Etable);
212 |
213 | javax.swing.GroupLayout EpaneLayout = new javax.swing.GroupLayout(Epane);
214 | Epane.setLayout(EpaneLayout);
215 | EpaneLayout.setHorizontalGroup(
216 | EpaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
217 | .addComponent(header, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
218 | .addGroup(EpaneLayout.createSequentialGroup()
219 | .addGap(29, 29, 29)
220 | .addGroup(EpaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
221 | .addComponent(jLabel1)
222 | .addComponent(jLabel5)
223 | .addComponent(jLabel3)
224 | .addComponent(jLabel4)
225 | .addComponent(jLabel2))
226 | .addGap(73, 73, 73)
227 | .addGroup(EpaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
228 | .addComponent(Ephone, javax.swing.GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE)
229 | .addComponent(Ename)
230 | .addComponent(Eaddress)
231 | .addComponent(Eid)
232 | .addComponent(Ejdate, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
233 | .addGap(87, 87, 87)
234 | .addGroup(EpaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
235 | .addComponent(Clrbtn, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
236 | .addComponent(Delbtn, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
237 | .addComponent(Modbtn, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
238 | .addComponent(Addbtn, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE))
239 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
240 | .addGroup(EpaneLayout.createSequentialGroup()
241 | .addContainerGap()
242 | .addComponent(Espane)
243 | .addContainerGap())
244 | );
245 | EpaneLayout.setVerticalGroup(
246 | EpaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
247 | .addGroup(EpaneLayout.createSequentialGroup()
248 | .addComponent(header, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
249 | .addGap(50, 50, 50)
250 | .addGroup(EpaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
251 | .addComponent(jLabel2)
252 | .addComponent(Eid, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
253 | .addGap(2, 2, 2)
254 | .addComponent(Addbtn, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
255 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
256 | .addGroup(EpaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
257 | .addGroup(EpaneLayout.createSequentialGroup()
258 | .addGroup(EpaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
259 | .addComponent(Ename, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
260 | .addComponent(jLabel1))
261 | .addGap(41, 41, 41))
262 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, EpaneLayout.createSequentialGroup()
263 | .addComponent(Modbtn, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
264 | .addGap(10, 10, 10)))
265 | .addGroup(EpaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
266 | .addGroup(EpaneLayout.createSequentialGroup()
267 | .addGroup(EpaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
268 | .addComponent(jLabel5)
269 | .addComponent(Ephone, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
270 | .addGap(36, 36, 36)
271 | .addGroup(EpaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
272 | .addComponent(Eaddress, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
273 | .addComponent(jLabel3))
274 | .addGap(40, 40, 40)
275 | .addGroup(EpaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
276 | .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
277 | .addComponent(Ejdate, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
278 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
279 | .addGroup(EpaneLayout.createSequentialGroup()
280 | .addGap(17, 17, 17)
281 | .addComponent(Clrbtn, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
282 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE)
283 | .addComponent(Delbtn, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
284 | .addGap(86, 86, 86)))
285 | .addComponent(Espane, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
286 | .addContainerGap())
287 | );
288 |
289 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
290 | getContentPane().setLayout(layout);
291 | layout.setHorizontalGroup(
292 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
293 | .addGroup(layout.createSequentialGroup()
294 | .addComponent(Epane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
295 | .addGap(0, 10, Short.MAX_VALUE))
296 | );
297 | layout.setVerticalGroup(
298 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
299 | .addComponent(Epane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
300 | );
301 |
302 | pack();
303 | }// //GEN-END:initComponents
304 |
305 | private void EnameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EnameActionPerformed
306 | // TODO add your handling code here:
307 | }//GEN-LAST:event_EnameActionPerformed
308 |
309 | private void EphoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EphoneActionPerformed
310 | // TODO add your handling code here:
311 | }//GEN-LAST:event_EphoneActionPerformed
312 |
313 | private void EaddressActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EaddressActionPerformed
314 | // TODO add your handling code here:
315 | }//GEN-LAST:event_EaddressActionPerformed
316 |
317 | private void EidActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EidActionPerformed
318 | // TODO add your handling code here:
319 | }//GEN-LAST:event_EidActionPerformed
320 |
321 | private void AddbtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddbtnActionPerformed
322 | // TODO add your handling code here:
323 | conn = Mysqlconnect.ConnectDB();
324 |
325 | String query = "INSERT INTO EMPLOYEE (ENAME,EPHONE,EADDRESS,EJDATE)VALUES(?,?,?,?)";
326 |
327 | try{
328 |
329 | pst =conn.prepareStatement(query);
330 | //pst.setString(1,Eid.getText());
331 | pst.setString(1,Ename.getText());
332 | pst.setString(2,Ephone.getText());
333 | pst.setString(3,Eaddress.getText());
334 | pst.setDate(4, new java.sql.Date(Ejdate.getDate().getTime()));
335 |
336 | pst.execute();
337 |
338 | JOptionPane.showMessageDialog(null,"Employee added");
339 |
340 | fetch();
341 |
342 | try{
343 |
344 | }
345 | catch(Exception e){
346 | JOptionPane.showMessageDialog(null,e);
347 | }
348 | }
349 | catch(Exception e){
350 | JOptionPane.showMessageDialog(null,e);
351 | }
352 |
353 | }//GEN-LAST:event_AddbtnActionPerformed
354 |
355 | private void ModbtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ModbtnActionPerformed
356 | // TODO add your handling code here:
357 | conn = Mysqlconnect.ConnectDB();
358 |
359 | int row = Etable.getSelectedRow();
360 | //System.out.println(row);
361 |
362 | String cell = Etable.getModel().getValueAt(row,0).toString();
363 |
364 | System.out.println(cell);
365 |
366 | String modsql = "UPDATE EMPLOYEE SET ENAME =?,EPHONE =?,EADDRESS=?,EJDATE=? WHERE EID ="+cell;
367 |
368 | try{
369 | pst=conn.prepareStatement(modsql);
370 |
371 | pst.setString(1,Ename.getText());
372 | pst.setString(2,Ephone.getText());
373 | pst.setString(3,Eaddress.getText());
374 | pst.setDate(4, new java.sql.Date(Ejdate.getDate().getTime()));
375 |
376 | pst.execute();
377 |
378 | JOptionPane.showMessageDialog(null,"Table Modified");
379 |
380 | fetch();
381 | }
382 |
383 | catch(Exception e){
384 | JOptionPane.showMessageDialog(null,e);
385 | }
386 | }//GEN-LAST:event_ModbtnActionPerformed
387 |
388 | private void DelbtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DelbtnActionPerformed
389 | // TODO add your handling code here:
390 | conn = Mysqlconnect.ConnectDB();
391 |
392 | int row = Etable.getSelectedRow();
393 | //System.out.println(row);
394 | String cell = Etable.getModel().getValueAt(row,0).toString();
395 | System.out.println(cell);
396 |
397 | String delsql = "DELETE FROM EMPLOYEE WHERE EID = "+ cell;
398 |
399 | try{
400 | pst=conn.prepareStatement(delsql);
401 | pst.execute();
402 | JOptionPane.showMessageDialog(null,"Employee Deleted");
403 | fetch();
404 | }
405 | catch(Exception e){
406 |
407 | }
408 | }//GEN-LAST:event_DelbtnActionPerformed
409 |
410 | private void ClrbtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ClrbtnActionPerformed
411 | // TODO add your handling code here:
412 | Eid.setText(" ");
413 | Ename.setText(" ");
414 | Ephone.setText(" ");
415 | Eaddress.setText(" ");
416 | Ejdate.setDate(null);
417 | }//GEN-LAST:event_ClrbtnActionPerformed
418 |
419 | private void headerMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_headerMouseClicked
420 | // TODO add your handling code here:
421 | dispose();
422 | Home Hobj = new Home();
423 | Hobj.setVisible(true);
424 | }//GEN-LAST:event_headerMouseClicked
425 |
426 | private void EtableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_EtableMouseClicked
427 | // TODO add your handling code here:
428 | // TODO add your handling code here:
429 | // TO LOAD DATA INTO TEXT FIELD
430 | DefaultTableModel model = (DefaultTableModel)Etable.getModel();
431 |
432 | // get the selected row index
433 | int selectedRowIndex = Etable.getSelectedRow();
434 |
435 | // set the selected row data into jtextfields
436 | Eid.setText(model.getValueAt(selectedRowIndex, 0).toString());
437 | Ename.setText(model.getValueAt(selectedRowIndex, 1).toString());
438 | Ephone.setText(model.getValueAt(selectedRowIndex, 2).toString());
439 | Eaddress.setText(model.getValueAt(selectedRowIndex, 3).toString());
440 | java.util.Date date1;
441 |
442 |
443 | try {
444 | date1 = new SimpleDateFormat("yyyy-MM-dd").parse(model.getValueAt(selectedRowIndex,4).toString());
445 | Ejdate.setDate(date1);
446 |
447 | } catch (ParseException ex) {
448 | Logger.getLogger(Book_Trip.class.getName()).log(Level.SEVERE, null, ex);
449 | }
450 |
451 | // try {
452 | // Date date = (Date) new SimpleDateFormat("yyyy-MM-dd").parse((String)model.getValueAt(selectedRowIndex, 4));
453 | // //System.out.println(date.toString());
454 | // Ejdate.setDate(model.getValueAt(selectedRowIndex,date);
455 | // }
456 | // catch (ParseException ex) {
457 | // Logger.getLogger(Employee.class.getName()).log(Level.SEVERE, null, ex);
458 | // }
459 | }//GEN-LAST:event_EtableMouseClicked
460 |
461 | /**
462 | * @param args the command line arguments
463 | */
464 | public static void main(String args[]) {
465 | /* Set the Nimbus look and feel */
466 | //
467 | /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
468 | * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
469 | */
470 |
471 | try {
472 | for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
473 | if ("Nimbus".equals(info.getName())) {
474 | javax.swing.UIManager.setLookAndFeel(info.getClassName());
475 | break;
476 | }
477 | }
478 | } catch (ClassNotFoundException ex) {
479 | java.util.logging.Logger.getLogger(Employee.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
480 | } catch (InstantiationException ex) {
481 | java.util.logging.Logger.getLogger(Employee.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
482 | } catch (IllegalAccessException ex) {
483 | java.util.logging.Logger.getLogger(Employee.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
484 | } catch (javax.swing.UnsupportedLookAndFeelException ex) {
485 | java.util.logging.Logger.getLogger(Employee.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
486 | }
487 | //
488 |
489 | /* Create and display the form */
490 | java.awt.EventQueue.invokeLater(new Runnable() {
491 | public void run() {
492 | new Employee().setVisible(true);
493 |
494 | }
495 | });
496 | }
497 |
498 | // Variables declaration - do not modify//GEN-BEGIN:variables
499 | private javax.swing.JButton Addbtn;
500 | private javax.swing.JButton Clrbtn;
501 | private javax.swing.JButton Delbtn;
502 | private javax.swing.JTextField Eaddress;
503 | private javax.swing.JTextField Eid;
504 | private org.jdesktop.swingx.JXDatePicker Ejdate;
505 | private javax.swing.JTextField Ename;
506 | private javax.swing.JPanel Epane;
507 | private javax.swing.JTextField Ephone;
508 | private javax.swing.JScrollPane Espane;
509 | private javax.swing.JTable Etable;
510 | private javax.swing.JButton Modbtn;
511 | private javax.swing.JPanel header;
512 | private javax.swing.JLabel jLabel1;
513 | private javax.swing.JLabel jLabel2;
514 | private javax.swing.JLabel jLabel3;
515 | private javax.swing.JLabel jLabel4;
516 | private javax.swing.JLabel jLabel5;
517 | private javax.swing.JLabel jLabel6;
518 | // End of variables declaration//GEN-END:variables
519 | }
520 |
--------------------------------------------------------------------------------
/src/TAMS/Vechicle.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
428 |
--------------------------------------------------------------------------------
/src/TAMS/Vechicle.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package TAMS;
7 |
8 | import java.sql.*;
9 | import java.util.ArrayList;
10 | import javax.swing.*;
11 | import java.util.Date;
12 | import java.util.logging.Level;
13 | import java.util.logging.Logger;
14 | import javax.swing.table.DefaultTableModel;
15 | import javax.swing.table.TableModel;
16 | import net.proteanit.sql.DbUtils;
17 | /**
18 | *
19 | * @author HP
20 | */
21 | public class Vechicle extends javax.swing.JFrame {
22 | Connection conn=null;
23 | PreparedStatement pst=null;
24 | ResultSet rs=null;
25 |
26 | public Vechicle() {
27 | initComponents();
28 | //setExtendedState(MAXIMIZED_BOTH);
29 | conn = Mysqlconnect.ConnectDB();
30 | fetch();
31 |
32 | }
33 |
34 | /**
35 | * Creates new form
36 | */
37 | public void fetch(){
38 | try{
39 | String sql="select * from vehicle";
40 | pst=conn.prepareStatement(sql);
41 | rs=pst.executeQuery();
42 | Vtable.setModel(DbUtils.resultSetToTableModel(rs));
43 | }
44 |
45 | catch(Exception e){
46 | JOptionPane.showMessageDialog(null,e);
47 | }
48 | }
49 |
50 |
51 |
52 |
53 | /**
54 | * This method is called from within the constructor to initialize the form.
55 | * WARNING: Do NOT modify this code. The content of this method is always
56 | * regenerated by the Form Editor.
57 | */
58 | @SuppressWarnings("unchecked")
59 | // //GEN-BEGIN:initComponents
60 | private void initComponents() {
61 |
62 | jLabel7 = new javax.swing.JLabel();
63 | bg = new javax.swing.JPanel();
64 | header = new javax.swing.JPanel();
65 | jLabel6 = new javax.swing.JLabel();
66 | Back = new javax.swing.JLabel();
67 | back = new javax.swing.JLabel();
68 | sidepane = new javax.swing.JPanel();
69 | cap = new javax.swing.JTextField();
70 | jLabel2 = new javax.swing.JLabel();
71 | jLabel3 = new javax.swing.JLabel();
72 | jLabel4 = new javax.swing.JLabel();
73 | jLabel5 = new javax.swing.JLabel();
74 | Vname = new javax.swing.JTextField();
75 | Regno = new javax.swing.JTextField();
76 | Vtype = new javax.swing.JTextField();
77 | Modbtn = new javax.swing.JButton();
78 | Delbtn = new javax.swing.JButton();
79 | Clrbtn = new javax.swing.JButton();
80 | Addbtn = new javax.swing.JButton();
81 | scrolvehicletable = new javax.swing.JScrollPane();
82 | Vtable = new javax.swing.JTable();
83 |
84 | jLabel7.setText("jLabel7");
85 |
86 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
87 | addMouseListener(new java.awt.event.MouseAdapter() {
88 | public void mouseEntered(java.awt.event.MouseEvent evt) {
89 | formMouseEntered(evt);
90 | }
91 | });
92 |
93 | header.setBackground(new java.awt.Color(102, 0, 153));
94 | header.addMouseListener(new java.awt.event.MouseAdapter() {
95 | public void mouseClicked(java.awt.event.MouseEvent evt) {
96 | headerMouseClicked(evt);
97 | }
98 | });
99 |
100 | jLabel6.setFont(new java.awt.Font("Segoe UI", 1, 22)); // NOI18N
101 | jLabel6.setForeground(new java.awt.Color(255, 255, 255));
102 | jLabel6.setText("VECHICLE DASHBOARD");
103 |
104 | javax.swing.GroupLayout headerLayout = new javax.swing.GroupLayout(header);
105 | header.setLayout(headerLayout);
106 | headerLayout.setHorizontalGroup(
107 | headerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
108 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, headerLayout.createSequentialGroup()
109 | .addGap(207, 207, 207)
110 | .addComponent(back)
111 | .addGap(18, 18, 18)
112 | .addComponent(Back)
113 | .addGap(73, 73, 73)
114 | .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 274, javax.swing.GroupLayout.PREFERRED_SIZE)
115 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
116 | );
117 | headerLayout.setVerticalGroup(
118 | headerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
119 | .addGroup(headerLayout.createSequentialGroup()
120 | .addContainerGap()
121 | .addGroup(headerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
122 | .addComponent(Back)
123 | .addComponent(back))
124 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
125 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, headerLayout.createSequentialGroup()
126 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
127 | .addComponent(jLabel6)
128 | .addContainerGap())
129 | );
130 |
131 | sidepane.setBackground(new java.awt.Color(0, 0, 51));
132 | sidepane.addMouseListener(new java.awt.event.MouseAdapter() {
133 | public void mouseEntered(java.awt.event.MouseEvent evt) {
134 | sidepaneMouseEntered(evt);
135 | }
136 | });
137 |
138 | cap.addActionListener(new java.awt.event.ActionListener() {
139 | public void actionPerformed(java.awt.event.ActionEvent evt) {
140 | capActionPerformed(evt);
141 | }
142 | });
143 |
144 | jLabel2.setBackground(new java.awt.Color(255, 255, 255));
145 | jLabel2.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
146 | jLabel2.setForeground(new java.awt.Color(255, 255, 255));
147 | jLabel2.setText("Vechicle Name");
148 |
149 | jLabel3.setBackground(new java.awt.Color(255, 255, 255));
150 | jLabel3.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
151 | jLabel3.setForeground(new java.awt.Color(255, 255, 255));
152 | jLabel3.setText("Capacity ");
153 |
154 | jLabel4.setBackground(new java.awt.Color(255, 255, 255));
155 | jLabel4.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
156 | jLabel4.setForeground(new java.awt.Color(255, 255, 255));
157 | jLabel4.setText("Register Number");
158 |
159 | jLabel5.setBackground(new java.awt.Color(255, 255, 255));
160 | jLabel5.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
161 | jLabel5.setForeground(new java.awt.Color(255, 255, 255));
162 | jLabel5.setText("Vechicle Type ");
163 |
164 | Vname.addActionListener(new java.awt.event.ActionListener() {
165 | public void actionPerformed(java.awt.event.ActionEvent evt) {
166 | VnameActionPerformed(evt);
167 | }
168 | });
169 |
170 | Regno.addActionListener(new java.awt.event.ActionListener() {
171 | public void actionPerformed(java.awt.event.ActionEvent evt) {
172 | RegnoActionPerformed(evt);
173 | }
174 | });
175 |
176 | Vtype.addActionListener(new java.awt.event.ActionListener() {
177 | public void actionPerformed(java.awt.event.ActionEvent evt) {
178 | VtypeActionPerformed(evt);
179 | }
180 | });
181 |
182 | Modbtn.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
183 | Modbtn.setText("MODIFY");
184 | Modbtn.addActionListener(new java.awt.event.ActionListener() {
185 | public void actionPerformed(java.awt.event.ActionEvent evt) {
186 | ModbtnActionPerformed(evt);
187 | }
188 | });
189 |
190 | Delbtn.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
191 | Delbtn.setText("DELETE");
192 | Delbtn.addActionListener(new java.awt.event.ActionListener() {
193 | public void actionPerformed(java.awt.event.ActionEvent evt) {
194 | DelbtnActionPerformed(evt);
195 | }
196 | });
197 |
198 | Clrbtn.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
199 | Clrbtn.setText("CLEAR");
200 | Clrbtn.addActionListener(new java.awt.event.ActionListener() {
201 | public void actionPerformed(java.awt.event.ActionEvent evt) {
202 | ClrbtnActionPerformed(evt);
203 | }
204 | });
205 |
206 | Addbtn.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
207 | Addbtn.setText("ADD");
208 | Addbtn.addActionListener(new java.awt.event.ActionListener() {
209 | public void actionPerformed(java.awt.event.ActionEvent evt) {
210 | AddbtnActionPerformed(evt);
211 | }
212 | });
213 |
214 | scrolvehicletable.addMouseListener(new java.awt.event.MouseAdapter() {
215 | public void mouseClicked(java.awt.event.MouseEvent evt) {
216 | scrolvehicletableMouseClicked(evt);
217 | }
218 | });
219 |
220 | Vtable.setModel(new javax.swing.table.DefaultTableModel(
221 | new Object [][] {
222 |
223 | },
224 | new String [] {
225 | "Vechicle ID", "Vechicle Name", "Vechicle Type", "Capacity", "Register Number"
226 | }
227 | ));
228 | Vtable.addMouseListener(new java.awt.event.MouseAdapter() {
229 | public void mouseClicked(java.awt.event.MouseEvent evt) {
230 | VtableMouseClicked(evt);
231 | }
232 | });
233 | Vtable.addKeyListener(new java.awt.event.KeyAdapter() {
234 | public void keyTyped(java.awt.event.KeyEvent evt) {
235 | VtableKeyTyped(evt);
236 | }
237 | });
238 | scrolvehicletable.setViewportView(Vtable);
239 |
240 | javax.swing.GroupLayout sidepaneLayout = new javax.swing.GroupLayout(sidepane);
241 | sidepane.setLayout(sidepaneLayout);
242 | sidepaneLayout.setHorizontalGroup(
243 | sidepaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
244 | .addGroup(sidepaneLayout.createSequentialGroup()
245 | .addContainerGap()
246 | .addGroup(sidepaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
247 | .addGroup(sidepaneLayout.createSequentialGroup()
248 | .addComponent(scrolvehicletable, javax.swing.GroupLayout.PREFERRED_SIZE, 839, javax.swing.GroupLayout.PREFERRED_SIZE)
249 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
250 | .addGroup(sidepaneLayout.createSequentialGroup()
251 | .addGap(32, 32, 32)
252 | .addGroup(sidepaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
253 | .addComponent(jLabel5)
254 | .addComponent(jLabel2)
255 | .addComponent(jLabel3)
256 | .addComponent(jLabel4))
257 | .addGroup(sidepaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
258 | .addGroup(sidepaneLayout.createSequentialGroup()
259 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
260 | .addGroup(sidepaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
261 | .addComponent(Vtype, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE)
262 | .addComponent(cap, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE)
263 | .addComponent(Vname, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE))
264 | .addGap(125, 125, 125)
265 | .addGroup(sidepaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
266 | .addComponent(Modbtn, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
267 | .addComponent(Addbtn, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
268 | .addComponent(Delbtn, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)))
269 | .addGroup(sidepaneLayout.createSequentialGroup()
270 | .addGap(66, 66, 66)
271 | .addComponent(Regno, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE)
272 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
273 | .addComponent(Clrbtn, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)))
274 | .addGap(103, 103, 103))))
275 | );
276 | sidepaneLayout.setVerticalGroup(
277 | sidepaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
278 | .addGroup(sidepaneLayout.createSequentialGroup()
279 | .addContainerGap(92, Short.MAX_VALUE)
280 | .addGroup(sidepaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
281 | .addGroup(sidepaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
282 | .addComponent(Vname, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
283 | .addComponent(jLabel2))
284 | .addComponent(Addbtn, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE))
285 | .addGap(28, 28, 28)
286 | .addGroup(sidepaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
287 | .addGroup(sidepaneLayout.createSequentialGroup()
288 | .addGroup(sidepaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
289 | .addComponent(jLabel5)
290 | .addComponent(Vtype, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
291 | .addComponent(Modbtn, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE))
292 | .addGroup(sidepaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
293 | .addGroup(sidepaneLayout.createSequentialGroup()
294 | .addGap(41, 41, 41)
295 | .addComponent(cap, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))
296 | .addGroup(sidepaneLayout.createSequentialGroup()
297 | .addGap(26, 26, 26)
298 | .addComponent(Delbtn, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)))
299 | .addGap(18, 18, 18)
300 | .addComponent(Clrbtn, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE))
301 | .addGroup(sidepaneLayout.createSequentialGroup()
302 | .addGap(77, 77, 77)
303 | .addComponent(jLabel3)
304 | .addGap(38, 38, 38)
305 | .addGroup(sidepaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
306 | .addComponent(Regno, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
307 | .addComponent(jLabel4))))
308 | .addGap(81, 81, 81)
309 | .addComponent(scrolvehicletable, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
310 | .addContainerGap())
311 | );
312 |
313 | javax.swing.GroupLayout bgLayout = new javax.swing.GroupLayout(bg);
314 | bg.setLayout(bgLayout);
315 | bgLayout.setHorizontalGroup(
316 | bgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
317 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, bgLayout.createSequentialGroup()
318 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
319 | .addGroup(bgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
320 | .addComponent(header, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
321 | .addComponent(sidepane, javax.swing.GroupLayout.PREFERRED_SIZE, 856, javax.swing.GroupLayout.PREFERRED_SIZE))
322 | .addGap(332, 332, 332))
323 | );
324 | bgLayout.setVerticalGroup(
325 | bgLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
326 | .addGroup(bgLayout.createSequentialGroup()
327 | .addComponent(header, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
328 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
329 | .addComponent(sidepane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
330 | );
331 |
332 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
333 | getContentPane().setLayout(layout);
334 | layout.setHorizontalGroup(
335 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
336 | .addGroup(layout.createSequentialGroup()
337 | .addComponent(bg, javax.swing.GroupLayout.PREFERRED_SIZE, 869, javax.swing.GroupLayout.PREFERRED_SIZE)
338 | .addGap(0, 1, Short.MAX_VALUE))
339 | );
340 | layout.setVerticalGroup(
341 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
342 | .addGroup(layout.createSequentialGroup()
343 | .addComponent(bg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
344 | .addGap(0, 0, Short.MAX_VALUE))
345 | );
346 |
347 | pack();
348 | }// //GEN-END:initComponents
349 |
350 | private void capActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_capActionPerformed
351 | // TODO add your handling code here:
352 | }//GEN-LAST:event_capActionPerformed
353 |
354 | private void VnameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_VnameActionPerformed
355 | // TODO add your handling code here:
356 | }//GEN-LAST:event_VnameActionPerformed
357 |
358 | private void RegnoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RegnoActionPerformed
359 | // TODO add your handling code here:
360 | }//GEN-LAST:event_RegnoActionPerformed
361 |
362 | private void VtypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_VtypeActionPerformed
363 | // TODO add your handling code here:
364 | }//GEN-LAST:event_VtypeActionPerformed
365 |
366 | private void ModbtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ModbtnActionPerformed
367 | // TODO add your handling code here:
368 | conn = Mysqlconnect.ConnectDB();
369 |
370 | int row = Vtable.getSelectedRow();
371 | //System.out.println(row);
372 | String cell = Vtable.getModel().getValueAt(row,0).toString();
373 | System.out.println(cell);
374 |
375 | String modsql = "UPDATE VEHICLE SET VNAME =?,CAPACITY =?,VTYPE=?,REGNO=? WHERE VID ="+cell;
376 |
377 | try{
378 | pst=conn.prepareStatement(modsql);
379 |
380 | pst.setString(1,Vname.getText());
381 | pst.setString(2,cap.getText());
382 | pst.setString(3,Vtype.getText());
383 | pst.setString(4,Regno.getText());
384 |
385 | pst.execute();
386 | JOptionPane.showMessageDialog(null,"Table Modified");
387 | fetch();
388 | }
389 | catch(Exception e){
390 |
391 | JOptionPane.showMessageDialog(null,e);
392 | }
393 |
394 |
395 |
396 | }//GEN-LAST:event_ModbtnActionPerformed
397 |
398 | private void DelbtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DelbtnActionPerformed
399 | // TODO add your handling code here:
400 | conn = Mysqlconnect.ConnectDB();
401 |
402 | int row = Vtable.getSelectedRow();
403 | //System.out.println(row);
404 | String cell = Vtable.getModel().getValueAt(row,0).toString();
405 | System.out.println(cell);
406 |
407 | String delsql = "DELETE FROM VEHICLE WHERE VID = "+ cell;
408 |
409 | try{
410 | pst=conn.prepareStatement(delsql);
411 | pst.execute();
412 |
413 | fetch();
414 | }
415 | catch(Exception e){
416 |
417 | }
418 | }//GEN-LAST:event_DelbtnActionPerformed
419 |
420 | private void ClrbtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ClrbtnActionPerformed
421 | // Vid2.setText(" ");
422 | Vname.setText(" ");
423 | cap.setText(" ");
424 | Vtype.setText(" ");
425 | Regno.setText(" ");
426 |
427 | }//GEN-LAST:event_ClrbtnActionPerformed
428 |
429 | private void AddbtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AddbtnActionPerformed
430 | conn = Mysqlconnect.ConnectDB();
431 |
432 | // String query = "insert into vehicle (vid, vname, capacity, type, regno)"
433 | // + " values (?, ?, ?, ?, ?)";
434 |
435 | String query = "insert into vehicle ( vname, capacity, vtype, regno)"
436 | + " values ( ?, ?, ?, ?)";
437 |
438 | try{
439 | pst=conn.prepareStatement(query);
440 |
441 | //41111111111111111111111111111111111111111111111111111111111 pst.setString(1,Vid2.getText());
442 |
443 | pst = conn.prepareStatement(query, Statement.RETURN_GENERATED_KEYS);
444 | pst.setString(1,Vname.getText());
445 | pst.setString(2,cap.getText());
446 | pst.setString(3,Vtype.getText());
447 | pst.setString(4,Regno.getText());
448 |
449 | pst.execute();
450 |
451 |
452 |
453 | JOptionPane.showMessageDialog(null,"vechicle added");
454 |
455 | try{
456 | String sql="select * from vehicle";
457 | pst=conn.prepareStatement(sql);
458 | rs=pst.executeQuery();
459 | Vtable.setModel(DbUtils.resultSetToTableModel(rs));
460 | }
461 | catch(Exception e){
462 | JOptionPane.showMessageDialog(null,e);
463 |
464 | }
465 |
466 |
467 |
468 | conn.close();
469 | }
470 | catch (Exception e){
471 | JOptionPane.showMessageDialog(null, e);
472 | }
473 | // TODO add your handling code here:
474 | }//GEN-LAST:event_AddbtnActionPerformed
475 |
476 | private void headerMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_headerMouseClicked
477 | // TODO add your handling code here:
478 | dispose();
479 | Home Hobj = new Home();
480 | Hobj.setVisible(true);
481 |
482 | }//GEN-LAST:event_headerMouseClicked
483 |
484 | private void scrolvehicletableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_scrolvehicletableMouseClicked
485 |
486 | }//GEN-LAST:event_scrolvehicletableMouseClicked
487 |
488 | private void VtableKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_VtableKeyTyped
489 | // TODO add your handling code here:
490 | }//GEN-LAST:event_VtableKeyTyped
491 |
492 | private void VtableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_VtableMouseClicked
493 | // TODO add your handling code here:
494 | // TO LOAD DATA INTO TEXT FIELD
495 | DefaultTableModel model = (DefaultTableModel)Vtable.getModel();
496 |
497 | // get the selected row index
498 | int selectedRowIndex = Vtable.getSelectedRow();
499 |
500 | // set the selected row data into jtextfields
501 | //Vid2.setText(model.getValueAt(selectedRowIndex, 0).toString());
502 | Vname.setText(model.getValueAt(selectedRowIndex, 1).toString());
503 | cap.setText(model.getValueAt(selectedRowIndex, 2).toString());
504 | Vtype.setText(model.getValueAt(selectedRowIndex, 3).toString());
505 | Regno.setText(model.getValueAt(selectedRowIndex, 4).toString());
506 | }//GEN-LAST:event_VtableMouseClicked
507 |
508 | private void sidepaneMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_sidepaneMouseEntered
509 | // TODO add your handling code here:
510 |
511 | //
512 | }//GEN-LAST:event_sidepaneMouseEntered
513 |
514 | private void formMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseEntered
515 |
516 | }//GEN-LAST:event_formMouseEntered
517 |
518 | /**
519 | * @param args the command line arguments
520 | */
521 | public static void main(String args[]) {
522 | /* Set the Nimbus look and feel */
523 | //
524 | /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
525 | * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
526 | */
527 | try {
528 | for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
529 | if ("Nimbus".equals(info.getName())) {
530 | javax.swing.UIManager.setLookAndFeel(info.getClassName());
531 | break;
532 | }
533 | }
534 | } catch (ClassNotFoundException ex) {
535 | java.util.logging.Logger.getLogger(Vechicle.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
536 | } catch (InstantiationException ex) {
537 | java.util.logging.Logger.getLogger(Vechicle.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
538 | } catch (IllegalAccessException ex) {
539 | java.util.logging.Logger.getLogger(Vechicle.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
540 | } catch (javax.swing.UnsupportedLookAndFeelException ex) {
541 | java.util.logging.Logger.getLogger(Vechicle.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
542 | }
543 | //
544 |
545 | /* Create and display the form */
546 | java.awt.EventQueue.invokeLater(new Runnable() {
547 | public void run() {
548 | new Vechicle().setVisible(true);
549 | }
550 | });
551 | }
552 |
553 | // Variables declaration - do not modify//GEN-BEGIN:variables
554 | private javax.swing.JButton Addbtn;
555 | private javax.swing.JLabel Back;
556 | private javax.swing.JButton Clrbtn;
557 | private javax.swing.JButton Delbtn;
558 | private javax.swing.JButton Modbtn;
559 | private javax.swing.JTextField Regno;
560 | private javax.swing.JTextField Vname;
561 | private javax.swing.JTable Vtable;
562 | private javax.swing.JTextField Vtype;
563 | private javax.swing.JLabel back;
564 | private javax.swing.JPanel bg;
565 | private javax.swing.JTextField cap;
566 | private javax.swing.JPanel header;
567 | private javax.swing.JLabel jLabel2;
568 | private javax.swing.JLabel jLabel3;
569 | private javax.swing.JLabel jLabel4;
570 | private javax.swing.JLabel jLabel5;
571 | private javax.swing.JLabel jLabel6;
572 | private javax.swing.JLabel jLabel7;
573 | private javax.swing.JScrollPane scrolvehicletable;
574 | private javax.swing.JPanel sidepane;
575 | // End of variables declaration//GEN-END:variables
576 | }
577 |
578 |
--------------------------------------------------------------------------------
/src/TAMS/Confirm_book.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
481 |
--------------------------------------------------------------------------------