├── assets
├── filingSystem
│ ├── trainQueue.csv
│ ├── official.csv
│ ├── passenger.csv
│ ├── ticket.csv
│ ├── trainScreen.csv
│ └── trains.csv
└── images
│ ├── back.png
│ ├── index1.png
│ ├── index2.png
│ ├── index3.png
│ ├── index4.png
│ ├── index5.png
│ ├── pportal1.png
│ ├── pportal2.png
│ ├── Asset 1ldpi.png
│ ├── Asset 3ldpi.png
│ ├── Asset 4ldpi.png
│ ├── portalTrain.png
│ ├── portalTrain2.png
│ ├── ticketView1.png
│ ├── ticketView2.png
│ └── ticketBooking1.png
├── bin
├── view
│ ├── index.class
│ ├── index$1.class
│ ├── index$2.class
│ ├── index$3.class
│ ├── ticketView.class
│ ├── ticketBooking.class
│ ├── ticketView$1.class
│ ├── ticketView$2.class
│ ├── officialPortal.class
│ ├── passengerPortal.class
│ ├── ticketBooking$1.class
│ ├── ticketBooking$2.class
│ ├── ticketBooking$3.class
│ ├── ticketBooking$4.class
│ ├── ticketBooking$5.class
│ ├── officialLoginFrame.class
│ ├── officialPortal$1.class
│ ├── officialPortal$2.class
│ ├── officialPortal$3.class
│ ├── officialPortal$4.class
│ ├── officialPortal$5.class
│ ├── officialPortal$6.class
│ ├── passengerPortal$1.class
│ ├── passengerPortal$2.class
│ ├── passengerPortal$3.class
│ ├── passengerPortal$4.class
│ ├── officialLoginFrame$1.class
│ ├── officialLoginFrame$2.class
│ ├── officialLoginFrame$3.class
│ ├── passengerLoginFrame.class
│ ├── passengerTrainScreen.class
│ ├── passengerLoginFrame$1.class
│ ├── passengerLoginFrame$2.class
│ ├── passengerLoginFrame$3.class
│ ├── passengerLoginFrame$4.class
│ ├── passengerRegisterFrame.class
│ ├── passengerTrainScreen$1.class
│ ├── passengerTrainScreen$2.class
│ ├── passengerRegisterFrame$1.class
│ ├── passengerRegisterFrame$2.class
│ └── passengerRegisterFrame$3.class
└── data_structures
│ ├── arrays.class
│ ├── queue.class
│ ├── fileHandler.class
│ └── linkedList.class
├── .classpath
├── .project
├── .settings
└── org.eclipse.jdt.core.prefs
├── src
├── data_structures
│ ├── queue.java
│ ├── linkedList.java
│ ├── arrays.java
│ └── fileHandler.java
└── view
│ ├── index.java
│ ├── passengerPortal.java
│ ├── officialLoginFrame.java
│ ├── ticketView.java
│ ├── passengerRegisterFrame.java
│ ├── passengerLoginFrame.java
│ ├── passengerTrainScreen.java
│ ├── ticketBooking.java
│ └── officialPortal.java
└── README.md
/assets/filingSystem/trainQueue.csv:
--------------------------------------------------------------------------------
1 | Rithesh-Central-Express
2 |
--------------------------------------------------------------------------------
/assets/filingSystem/official.csv:
--------------------------------------------------------------------------------
1 | abishek@40,12345
2 | rithesh@44,12345
--------------------------------------------------------------------------------
/assets/filingSystem/passenger.csv:
--------------------------------------------------------------------------------
1 | anfas,anf,123
2 | aravind,arv,123
3 | abishek,abh,123
4 |
--------------------------------------------------------------------------------
/assets/filingSystem/ticket.csv:
--------------------------------------------------------------------------------
1 | Karunagapally,Kochi,2022-00-21,Abhinav,4,Abhinav-Orient-Express,600
--------------------------------------------------------------------------------
/bin/view/index.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/index.class
--------------------------------------------------------------------------------
/assets/images/back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/assets/images/back.png
--------------------------------------------------------------------------------
/bin/view/index$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/index$1.class
--------------------------------------------------------------------------------
/bin/view/index$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/index$2.class
--------------------------------------------------------------------------------
/bin/view/index$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/index$3.class
--------------------------------------------------------------------------------
/assets/images/index1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/assets/images/index1.png
--------------------------------------------------------------------------------
/assets/images/index2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/assets/images/index2.png
--------------------------------------------------------------------------------
/assets/images/index3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/assets/images/index3.png
--------------------------------------------------------------------------------
/assets/images/index4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/assets/images/index4.png
--------------------------------------------------------------------------------
/assets/images/index5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/assets/images/index5.png
--------------------------------------------------------------------------------
/bin/view/ticketView.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/ticketView.class
--------------------------------------------------------------------------------
/assets/images/pportal1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/assets/images/pportal1.png
--------------------------------------------------------------------------------
/assets/images/pportal2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/assets/images/pportal2.png
--------------------------------------------------------------------------------
/bin/view/ticketBooking.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/ticketBooking.class
--------------------------------------------------------------------------------
/bin/view/ticketView$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/ticketView$1.class
--------------------------------------------------------------------------------
/bin/view/ticketView$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/ticketView$2.class
--------------------------------------------------------------------------------
/assets/images/Asset 1ldpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/assets/images/Asset 1ldpi.png
--------------------------------------------------------------------------------
/assets/images/Asset 3ldpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/assets/images/Asset 3ldpi.png
--------------------------------------------------------------------------------
/assets/images/Asset 4ldpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/assets/images/Asset 4ldpi.png
--------------------------------------------------------------------------------
/assets/images/portalTrain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/assets/images/portalTrain.png
--------------------------------------------------------------------------------
/assets/images/portalTrain2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/assets/images/portalTrain2.png
--------------------------------------------------------------------------------
/assets/images/ticketView1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/assets/images/ticketView1.png
--------------------------------------------------------------------------------
/assets/images/ticketView2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/assets/images/ticketView2.png
--------------------------------------------------------------------------------
/bin/view/officialPortal.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/officialPortal.class
--------------------------------------------------------------------------------
/bin/view/passengerPortal.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/passengerPortal.class
--------------------------------------------------------------------------------
/bin/view/ticketBooking$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/ticketBooking$1.class
--------------------------------------------------------------------------------
/bin/view/ticketBooking$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/ticketBooking$2.class
--------------------------------------------------------------------------------
/bin/view/ticketBooking$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/ticketBooking$3.class
--------------------------------------------------------------------------------
/bin/view/ticketBooking$4.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/ticketBooking$4.class
--------------------------------------------------------------------------------
/bin/view/ticketBooking$5.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/ticketBooking$5.class
--------------------------------------------------------------------------------
/assets/images/ticketBooking1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/assets/images/ticketBooking1.png
--------------------------------------------------------------------------------
/bin/data_structures/arrays.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/data_structures/arrays.class
--------------------------------------------------------------------------------
/bin/data_structures/queue.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/data_structures/queue.class
--------------------------------------------------------------------------------
/bin/view/officialLoginFrame.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/officialLoginFrame.class
--------------------------------------------------------------------------------
/bin/view/officialPortal$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/officialPortal$1.class
--------------------------------------------------------------------------------
/bin/view/officialPortal$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/officialPortal$2.class
--------------------------------------------------------------------------------
/bin/view/officialPortal$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/officialPortal$3.class
--------------------------------------------------------------------------------
/bin/view/officialPortal$4.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/officialPortal$4.class
--------------------------------------------------------------------------------
/bin/view/officialPortal$5.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/officialPortal$5.class
--------------------------------------------------------------------------------
/bin/view/officialPortal$6.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/officialPortal$6.class
--------------------------------------------------------------------------------
/bin/view/passengerPortal$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/passengerPortal$1.class
--------------------------------------------------------------------------------
/bin/view/passengerPortal$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/passengerPortal$2.class
--------------------------------------------------------------------------------
/bin/view/passengerPortal$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/passengerPortal$3.class
--------------------------------------------------------------------------------
/bin/view/passengerPortal$4.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/passengerPortal$4.class
--------------------------------------------------------------------------------
/bin/view/officialLoginFrame$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/officialLoginFrame$1.class
--------------------------------------------------------------------------------
/bin/view/officialLoginFrame$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/officialLoginFrame$2.class
--------------------------------------------------------------------------------
/bin/view/officialLoginFrame$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/officialLoginFrame$3.class
--------------------------------------------------------------------------------
/bin/view/passengerLoginFrame.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/passengerLoginFrame.class
--------------------------------------------------------------------------------
/bin/view/passengerTrainScreen.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/passengerTrainScreen.class
--------------------------------------------------------------------------------
/bin/data_structures/fileHandler.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/data_structures/fileHandler.class
--------------------------------------------------------------------------------
/bin/data_structures/linkedList.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/data_structures/linkedList.class
--------------------------------------------------------------------------------
/bin/view/passengerLoginFrame$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/passengerLoginFrame$1.class
--------------------------------------------------------------------------------
/bin/view/passengerLoginFrame$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/passengerLoginFrame$2.class
--------------------------------------------------------------------------------
/bin/view/passengerLoginFrame$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/passengerLoginFrame$3.class
--------------------------------------------------------------------------------
/bin/view/passengerLoginFrame$4.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/passengerLoginFrame$4.class
--------------------------------------------------------------------------------
/bin/view/passengerRegisterFrame.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/passengerRegisterFrame.class
--------------------------------------------------------------------------------
/bin/view/passengerTrainScreen$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/passengerTrainScreen$1.class
--------------------------------------------------------------------------------
/bin/view/passengerTrainScreen$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/passengerTrainScreen$2.class
--------------------------------------------------------------------------------
/bin/view/passengerRegisterFrame$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/passengerRegisterFrame$1.class
--------------------------------------------------------------------------------
/bin/view/passengerRegisterFrame$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/passengerRegisterFrame$2.class
--------------------------------------------------------------------------------
/bin/view/passengerRegisterFrame$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Abhinavxox/Railway-Management-System/HEAD/bin/view/passengerRegisterFrame$3.class
--------------------------------------------------------------------------------
/assets/filingSystem/trainScreen.csv:
--------------------------------------------------------------------------------
1 | Jan-Shatabdi-Express,2:40
2 | Abhinav-Orient-Express,2:40
3 | Jan-Shatabdi-Express,2:40
4 | Abishek-Coastline,2:50
5 |
--------------------------------------------------------------------------------
/assets/filingSystem/trains.csv:
--------------------------------------------------------------------------------
1 | 1,Rajdhani-Express,300
2 | 2,Jan-Shatabdi-Express,250
3 | 3,Anfas-Bullet-Express,200
4 | 4,Abhinav-Orient-Express,150
5 | 5,Rithesh-Central-Express,150
6 | 6,Abishek-Coastline,70
7 | 7,Aravind-Eastern-Mail,70
8 |
--------------------------------------------------------------------------------
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Railway_Management_System
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
19 | 1656177294349
20 |
21 | 30
22 |
23 | org.eclipse.core.resources.regexFilterMatcher
24 | node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=15
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=15
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
13 | org.eclipse.jdt.core.compiler.release=enabled
14 | org.eclipse.jdt.core.compiler.source=15
15 |
--------------------------------------------------------------------------------
/src/data_structures/queue.java:
--------------------------------------------------------------------------------
1 | package data_structures;
2 |
3 | import java.io.IOException;
4 | import java.util.ArrayList;
5 | import java.util.LinkedList;
6 | import java.util.Queue;
7 |
8 | public class queue {
9 |
10 | public static Queue intialiseQueue() throws IOException {
11 | Queue queue = new LinkedList();
12 | //object from file
13 | ArrayList alist = fileHandler.getTrainQueue();
14 | //storing in linked list for further functions
15 | for (String strings : alist) {
16 | queue.add(strings);
17 | }
18 | return queue;
19 | }
20 |
21 | public static void saveQueue(Queue queue) throws IOException {
22 | ArrayList alist = new ArrayList();
23 | for (String string : queue) {
24 | alist.add(string);
25 | }
26 | fileHandler.setTrainQueue(alist);
27 | }
28 |
29 | public static void enqueue(String[] arr) throws IOException {
30 | Queue queue = intialiseQueue();
31 | queue.add(arr[0]);
32 | saveQueue(queue);
33 | }
34 |
35 | public static String dequeue() throws IOException {
36 | Queue queue = intialiseQueue();
37 | String returned = queue.peek();
38 | queue.remove();
39 | saveQueue(queue);
40 | return returned;
41 | }
42 |
43 | public static boolean isEmpty() throws IOException {
44 | Queue queue = intialiseQueue();
45 | if(queue.isEmpty()) {
46 | return true;
47 | }
48 | return false;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/data_structures/linkedList.java:
--------------------------------------------------------------------------------
1 | package data_structures;
2 |
3 | import java.io.IOException;
4 | import java.util.ArrayList;
5 | import java.util.LinkedList;
6 |
7 | public class linkedList {
8 |
9 | public static LinkedList intialiseList() throws IOException {
10 | LinkedList list = new LinkedList();
11 | //object from file
12 | ArrayList alist = arrays.getTrainScreen();
13 | //storing in linked list for further functions
14 | for (String[] strings : alist) {
15 | list.add(strings);
16 | }
17 | return list;
18 | }
19 |
20 | public static void saveList(LinkedList list) throws IOException {
21 | ArrayList alist = new ArrayList();
22 | for(int i=0; i< list.size(); i++) {
23 | alist.add(list.get(i));
24 | }
25 | fileHandler.refreshTrainScreen(alist);
26 | }
27 |
28 | public static void deleteFromBeginning() throws IOException {
29 | LinkedList list = intialiseList();
30 | list.remove(0);
31 | saveList(list);
32 | }
33 |
34 | public static void insertAtBack(String[] arr) throws IOException {
35 | LinkedList list = intialiseList();
36 | list.add(arr);
37 | saveList(list);
38 | }
39 |
40 | public static String[] deleteFromMiddle(int index) throws IOException {
41 | LinkedList list = intialiseList();
42 | String[] arr = list.get(index);
43 | list.remove(index);
44 | saveList(list);
45 | return arr;
46 | }
47 |
48 | public static void insertAtMiddle(String[] arr) throws IOException {
49 | LinkedList list = intialiseList();
50 | list.add(arr);
51 | saveList(list);
52 | }
53 |
54 | public static boolean isEmpty() throws IOException {
55 | LinkedList list = intialiseList();
56 | if(list.isEmpty()) {
57 | return true;
58 | }
59 | return false;
60 |
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/src/data_structures/arrays.java:
--------------------------------------------------------------------------------
1 | package data_structures;
2 |
3 | import java.io.IOException;
4 | import java.util.ArrayList;
5 | import java.util.Arrays;
6 |
7 | public class arrays {
8 |
9 | public static fileHandler fh = new fileHandler();
10 |
11 | public static boolean getPassengers(String username, String password) throws IOException{
12 | /*
13 | * passengers details will be stored in arraList of string array
14 | * returns true if the login details in in the directory
15 | */
16 | ArrayList passengers = new ArrayList();
17 | passengers = fh.readPassenger();
18 | boolean contains = false;
19 | for (String[] x : passengers) {
20 | if(x[1].equals(username) && x[2].equals(password)) {
21 | contains = true;
22 | }
23 | }
24 | return contains;
25 | }
26 |
27 | public static boolean setPassengers(String name, String username, String password) throws IOException {
28 | /*
29 | * first check if the username already used by someone
30 | * if not then add to the file
31 | * returns true if successfully added
32 | */
33 | boolean set = true;
34 | ArrayList passengers = new ArrayList();
35 | passengers = fh.readPassenger();
36 |
37 | for(String[] x : passengers) {
38 | if(x[1].equals(username)) {
39 | set = false;
40 | }
41 | }
42 | //if username is unique
43 | if(set) {
44 | String arr [] = {name, username, password};
45 | fh.writePassenger(arr);
46 | }
47 | return set;
48 | }
49 |
50 | public static boolean getOfficials(String username, String password) throws IOException{
51 | /*
52 | * officials details will be stored in arraList of string array
53 | * Each passenger information is in
54 | */
55 | ArrayList officials = new ArrayList();
56 | officials = fh.readOfficial();
57 | boolean contains = false;
58 | for (String[] x : officials) {
59 | if(x[0].equals(username) && x[1].equals(password)) {
60 | contains = true;
61 | }
62 | }
63 | return contains;
64 | }
65 |
66 | public static ArrayList getTrains() throws IOException{
67 | /*
68 | * returns trains list with its price and name
69 | */
70 | ArrayList trains = new ArrayList();
71 | trains = fh.readTrain();
72 | return trains;
73 | }
74 |
75 | public static void setTicket(String[] arr) throws IOException{
76 | fh.writeTicket(arr);
77 | }
78 |
79 | public static String[] getTicket() throws IOException {
80 | ArrayList ticket = new ArrayList();
81 | ticket = fh.readTicket();
82 | return ticket.get(0);
83 | }
84 |
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/src/data_structures/fileHandler.java:
--------------------------------------------------------------------------------
1 | package data_structures;
2 |
3 | import java.io.BufferedWriter;
4 | import java.io.File;
5 | import java.io.FileWriter;
6 | import java.io.IOException;
7 | import java.util.ArrayList;
8 | import java.util.Scanner;
9 |
10 | public class fileHandler {
11 |
12 | //main reader method
13 | public static ArrayList mainRead(String filename, int noOfAttributes) throws IOException {
14 | File f = new File("C:/Users/abhin/Desktop/JAVA/workspace/Railway_Management_System/assets/filingSystem/"+filename);
15 | Scanner sc = new Scanner(f);
16 | ArrayList alist = new ArrayList();
17 | while(sc.hasNext()) {
18 | String line= sc.next();
19 | String[] arr = line.split(",",noOfAttributes);
20 | alist.add(arr);
21 | }
22 | return alist;
23 |
24 | }
25 |
26 | //main writer method
27 | public static void mainWrite(String filename, String data) throws IOException {
28 | File file = new File("C:/Users/abhin/Desktop/JAVA/workspace/Railway_Management_System/assets/filingSystem/"+filename);
29 | FileWriter fr = new FileWriter(file, true);
30 | BufferedWriter br = new BufferedWriter(fr);
31 | br.write(data);
32 | br.write("\n");
33 |
34 | br.close();
35 | fr.close();
36 | }
37 |
38 | //passenger write
39 | public static void writePassenger(String[] arr) throws IOException {
40 | StringBuilder sb = new StringBuilder();
41 | //name
42 | sb.append(arr[0]);
43 | sb.append(",");
44 | //username
45 | sb.append(arr[1]);
46 | sb.append(",");
47 | //password
48 | sb.append(arr[2]);
49 | mainWrite("passenger.csv", sb.toString());
50 | }
51 |
52 | //passengerRead
53 | public static ArrayList readPassenger() throws IOException {
54 | return mainRead("passenger.csv", 3);
55 | }
56 |
57 | //officialRead
58 | public static ArrayList readOfficial() throws IOException {
59 | return mainRead("official.csv", 2);
60 | }
61 |
62 | //trains
63 | public static ArrayList readTrain() throws IOException {
64 | return mainRead("trains.csv", 3);
65 | }
66 |
67 | //trains
68 | //passenger
69 | public static void writeTicket(String[] arr) throws IOException {
70 | File file = new File("C:/Users/abhin/Desktop/JAVA/workspace/Railway_Management_System/assets/filingSystem/ticket.csv");
71 | FileWriter fr = new FileWriter(file, false);
72 | StringBuilder sb = new StringBuilder();
73 | //name
74 | for(String x : arr) {
75 | sb.append(x);
76 | if(arr[arr.length-1]==x) {
77 | break;
78 | }
79 | sb.append(",");
80 | }
81 | fr.write(sb.toString());
82 | fr.close();
83 | }
84 |
85 | public static ArrayList readTicket() throws IOException {
86 | return mainRead("ticket.csv", 7);
87 | }
88 |
89 | //train screen
90 | public static void writeTrainScreen(String[] arr) throws IOException {
91 | StringBuilder sb = new StringBuilder();
92 | sb.append(arr[0]);
93 | sb.append(",");
94 | sb.append(arr[1]);
95 | mainWrite("trainScreen.csv", sb.toString());
96 | }
97 |
98 | public static void refreshTrainScreen(ArrayList alist) throws IOException{
99 | StringBuilder sb = new StringBuilder();
100 | File file = new File("C:/Users/abhin/Desktop/JAVA/workspace/Railway_Management_System/assets/filingSystem/trainScreen.csv");
101 | FileWriter fr = new FileWriter(file, false);
102 |
103 | for (String[] arr : alist) {
104 | sb.append(arr[0]);
105 | sb.append(",");
106 | sb.append(arr[1]);
107 | sb.append("\n");
108 | }
109 | fr.write(sb.toString());
110 | fr.close();
111 | }
112 |
113 | public static ArrayList readTrainScreen() throws IOException {
114 | return mainRead("trainScreen.csv", 2);
115 | }
116 |
117 | public static void setTrainQueue(ArrayList alist) throws IOException{
118 | File file = new File("C:/Users/abhin/Desktop/JAVA/workspace/Railway_Management_System/assets/filingSystem/trainQueue.csv");
119 | FileWriter fr = new FileWriter(file,false);
120 | StringBuilder sb = new StringBuilder();
121 | for (String x : alist) {
122 | sb.append(x+"\n");
123 | }
124 | fr.write(sb.toString());
125 | fr.close();
126 | }
127 |
128 | public static ArrayList getTrainQueue() throws IOException {
129 | File f = new File("C:/Users/abhin/Desktop/JAVA/workspace/Railway_Management_System/assets/filingSystem/trainQueue.csv");
130 | Scanner sc = new Scanner(f);
131 | ArrayList alist = new ArrayList();
132 | while(sc.hasNext()) {
133 | String line= sc.next();
134 | alist.add(line);
135 | }
136 | return alist;
137 | }
138 |
139 |
140 | }
141 |
--------------------------------------------------------------------------------
/src/view/index.java:
--------------------------------------------------------------------------------
1 | package view;
2 |
3 | import java.awt.BorderLayout;
4 | import java.awt.Color;
5 | import java.awt.EventQueue;
6 |
7 | import javax.swing.JFrame;
8 | import javax.swing.JPanel;
9 | import javax.swing.border.EmptyBorder;
10 | import javax.swing.JLabel;
11 | import java.awt.Font;
12 | import javax.swing.JSeparator;
13 | import javax.swing.ImageIcon;
14 | import java.awt.event.MouseAdapter;
15 | import java.awt.event.MouseEvent;
16 | import javax.swing.SwingConstants;
17 |
18 | public class index extends JFrame {
19 |
20 | private JPanel contentPane;
21 | private JLabel lblNewLabel;
22 | private JSeparator separator;
23 | private JLabel lblNewLabel_1;
24 | private JLabel lblNewLabel_2;
25 | private JLabel lblNewLabel_3;
26 | private JLabel lblNewLabel_3_1;
27 | private JLabel lblNewLabel_4;
28 | private JLabel lblNewLabel_4_1;
29 | private JLabel lblNewLabel_5;
30 | private JLabel lblNewLabel_5_1;
31 |
32 | /**
33 | * Launch the application.
34 | */
35 | public static void main(String[] args) {
36 | EventQueue.invokeLater(new Runnable() {
37 | public void run() {
38 | try {
39 | index frame = new index();
40 | frame.setVisible(true);
41 | } catch (Exception e) {
42 | e.printStackTrace();
43 | }
44 | }
45 | });
46 | }
47 |
48 | /**
49 | * Create the frame.
50 | */
51 | public index() {
52 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
53 | setBounds(100, 100, 900, 700);
54 | contentPane = new JPanel();
55 | contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
56 | setContentPane(contentPane);
57 | contentPane.setLayout(null);
58 | contentPane.setBackground(Color.decode("#2c3e50"));
59 | contentPane.add(getLblNewLabel_5_1());
60 | contentPane.add(getLblNewLabel_5());
61 | contentPane.add(getLblNewLabel_4_1());
62 | contentPane.add(getLblNewLabel_4());
63 | contentPane.add(getLblNewLabel_3_1());
64 | contentPane.add(getLblNewLabel_3());
65 | contentPane.add(getLblNewLabel());
66 | contentPane.add(getSeparator());
67 | contentPane.add(getLblNewLabel_1());
68 | contentPane.add(getLblNewLabel_2());
69 | }
70 | private JLabel getLblNewLabel() {
71 | if (lblNewLabel == null) {
72 | lblNewLabel = new JLabel("RAILWAY MANAGEMENT SYSTEM");
73 | lblNewLabel.setForeground(Color.WHITE);
74 | lblNewLabel.setFont(new Font("Press Start 2P", Font.BOLD, 30));
75 | lblNewLabel.setBounds(47, 11, 784, 84);
76 | }
77 | return lblNewLabel;
78 | }
79 | private JSeparator getSeparator() {
80 | if (separator == null) {
81 | separator = new JSeparator();
82 | separator.setBounds(35, 83, 802, 2);
83 | }
84 | return separator;
85 | }
86 | private JLabel getLblNewLabel_1() {
87 | if (lblNewLabel_1 == null) {
88 | lblNewLabel_1 = new JLabel("");
89 | lblNewLabel_1.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\index1.png"));
90 | lblNewLabel_1.setBounds(95, 188, 256, 389);
91 | }
92 | return lblNewLabel_1;
93 | }
94 | private JLabel getLblNewLabel_2() {
95 | if (lblNewLabel_2 == null) {
96 | lblNewLabel_2 = new JLabel("");
97 | lblNewLabel_2.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\index2.png"));
98 | lblNewLabel_2.setBounds(448, 122, 387, 499);
99 | }
100 | return lblNewLabel_2;
101 | }
102 | private JLabel getLblNewLabel_3() {
103 | if (lblNewLabel_3 == null) {
104 | lblNewLabel_3 = new JLabel("");
105 | lblNewLabel_3.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\index3.png"));
106 | lblNewLabel_3.setBounds(522, 300, 237, 77);
107 | }
108 | return lblNewLabel_3;
109 | }
110 | private JLabel getLblNewLabel_3_1() {
111 | if (lblNewLabel_3_1 == null) {
112 | lblNewLabel_3_1 = new JLabel("");
113 | lblNewLabel_3_1.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\index3.png"));
114 | lblNewLabel_3_1.setBounds(522, 524, 237, 77);
115 | }
116 | return lblNewLabel_3_1;
117 | }
118 | private JLabel getLblNewLabel_4() {
119 | if (lblNewLabel_4 == null) {
120 | lblNewLabel_4 = new JLabel("");
121 | lblNewLabel_4.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\index4.png"));
122 | lblNewLabel_4.setBounds(571, 163, 128, 152);
123 | }
124 | return lblNewLabel_4;
125 | }
126 | private JLabel getLblNewLabel_4_1() {
127 | if (lblNewLabel_4_1 == null) {
128 | lblNewLabel_4_1 = new JLabel("");
129 | lblNewLabel_4_1.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\index5.png"));
130 | lblNewLabel_4_1.setBounds(571, 388, 128, 152);
131 | }
132 | return lblNewLabel_4_1;
133 | }
134 | private JLabel getLblNewLabel_5() {
135 | if (lblNewLabel_5 == null) {
136 | lblNewLabel_5 = new JLabel("PASSENGER");
137 | lblNewLabel_5.setHorizontalAlignment(SwingConstants.CENTER);
138 | lblNewLabel_5.addMouseListener(new MouseAdapter() {
139 | @Override
140 | public void mouseClicked(MouseEvent e) {
141 | new passengerLoginFrame().setVisible(true);
142 | dispose();
143 | }
144 | });
145 | lblNewLabel_5.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
146 | lblNewLabel_5.setBounds(522, 300, 224, 74);
147 | }
148 | return lblNewLabel_5;
149 | }
150 | private JLabel getLblNewLabel_5_1() {
151 | if (lblNewLabel_5_1 == null) {
152 | lblNewLabel_5_1 = new JLabel("OFFICIAL");
153 | lblNewLabel_5_1.addMouseListener(new MouseAdapter() {
154 | @Override
155 | public void mouseClicked(MouseEvent e) {
156 | new officialLoginFrame().setVisible(true);
157 | dispose();
158 | }
159 | });
160 | lblNewLabel_5_1.setHorizontalAlignment(SwingConstants.CENTER);
161 | lblNewLabel_5_1.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
162 | lblNewLabel_5_1.setBounds(522, 524, 224, 76);
163 | }
164 | return lblNewLabel_5_1;
165 | }
166 | }
167 |
--------------------------------------------------------------------------------
/src/view/passengerPortal.java:
--------------------------------------------------------------------------------
1 | package view;
2 |
3 | import java.awt.BorderLayout;
4 | import java.awt.Color;
5 | import java.awt.EventQueue;
6 |
7 | import javax.swing.JFrame;
8 | import javax.swing.JPanel;
9 | import javax.swing.border.EmptyBorder;
10 | import javax.swing.JLabel;
11 | import javax.swing.ImageIcon;
12 | import java.awt.Font;
13 | import javax.swing.SwingConstants;
14 | import java.awt.event.MouseAdapter;
15 | import java.awt.event.MouseEvent;
16 | import java.io.IOException;
17 |
18 | public class passengerPortal extends JFrame {
19 |
20 | private JPanel contentPane;
21 | private JLabel lblNewLabel_2;
22 | private JLabel lblNewLabel_2_1;
23 | private JLabel lblTicket;
24 | private JLabel lblBooking;
25 | private JLabel lblScreen;
26 | private JLabel lblTrain;
27 | private JLabel lblNewLabel;
28 | private JLabel lblNewLabel_1;
29 | private JLabel lblNewLabel_3;
30 | private JLabel ticketBooking;
31 | private JLabel trainScreen;
32 |
33 | /**
34 | * Launch the application.
35 | */
36 | public static void main(String[] args) {
37 | EventQueue.invokeLater(new Runnable() {
38 | public void run() {
39 | try {
40 | passengerPortal frame = new passengerPortal();
41 | frame.setVisible(true);
42 | } catch (Exception e) {
43 | e.printStackTrace();
44 | }
45 | }
46 | });
47 | }
48 |
49 | /**
50 | * Create the frame.
51 | */
52 | public passengerPortal() {
53 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
54 | setBounds(100, 100, 900, 700);
55 | contentPane = new JPanel();
56 | contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
57 | contentPane.setBackground(Color.decode("#2c3e50"));
58 | setContentPane(contentPane);
59 | contentPane.setLayout(null);
60 | contentPane.add(getTrainScreen());
61 | contentPane.add(getTicketBooking());
62 | contentPane.add(getLblNewLabel_3());
63 | contentPane.add(getLblNewLabel_1());
64 | contentPane.add(getLblNewLabel());
65 | contentPane.add(getLblTrain());
66 | contentPane.add(getLblScreen());
67 | contentPane.add(getLblBooking());
68 | contentPane.add(getLblTicket());
69 | contentPane.add(getLblNewLabel_2());
70 | contentPane.add(getLblNewLabel_2_1());
71 | }
72 |
73 | private JLabel getLblNewLabel_2() {
74 | if (lblNewLabel_2 == null) {
75 | lblNewLabel_2 = new JLabel("");
76 | lblNewLabel_2.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\index2.png"));
77 | lblNewLabel_2.setBounds(43, 117, 387, 499);
78 | }
79 | return lblNewLabel_2;
80 | }
81 | private JLabel getLblNewLabel_2_1() {
82 | if (lblNewLabel_2_1 == null) {
83 | lblNewLabel_2_1 = new JLabel("");
84 | lblNewLabel_2_1.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\index2.png"));
85 | lblNewLabel_2_1.setBounds(468, 117, 387, 499);
86 | }
87 | return lblNewLabel_2_1;
88 | }
89 | private JLabel getLblTicket() {
90 | if (lblTicket == null) {
91 | lblTicket = new JLabel("TICKET\r\n");
92 | lblTicket.setHorizontalAlignment(SwingConstants.CENTER);
93 | lblTicket.setForeground(Color.BLACK);
94 | lblTicket.setFont(new Font("Press Start 2P", Font.BOLD, 30));
95 | lblTicket.setBounds(70, 156, 317, 84);
96 | }
97 | return lblTicket;
98 | }
99 | private JLabel getLblBooking() {
100 | if (lblBooking == null) {
101 | lblBooking = new JLabel("BOOKING");
102 | lblBooking.setHorizontalAlignment(SwingConstants.CENTER);
103 | lblBooking.setForeground(Color.BLACK);
104 | lblBooking.setFont(new Font("Press Start 2P", Font.BOLD, 30));
105 | lblBooking.setBounds(70, 240, 317, 84);
106 | }
107 | return lblBooking;
108 | }
109 | private JLabel getLblScreen() {
110 | if (lblScreen == null) {
111 | lblScreen = new JLabel("SCREEN");
112 | lblScreen.setHorizontalAlignment(SwingConstants.CENTER);
113 | lblScreen.setForeground(Color.BLACK);
114 | lblScreen.setFont(new Font("Press Start 2P", Font.BOLD, 30));
115 | lblScreen.setBounds(496, 240, 317, 84);
116 | }
117 | return lblScreen;
118 | }
119 | private JLabel getLblTrain() {
120 | if (lblTrain == null) {
121 | lblTrain = new JLabel("TRAIN");
122 | lblTrain.setHorizontalAlignment(SwingConstants.CENTER);
123 | lblTrain.setForeground(Color.BLACK);
124 | lblTrain.setFont(new Font("Press Start 2P", Font.BOLD, 30));
125 | lblTrain.setBounds(496, 156, 317, 84);
126 | }
127 | return lblTrain;
128 | }
129 | private JLabel getLblNewLabel() {
130 | if (lblNewLabel == null) {
131 | lblNewLabel = new JLabel("");
132 | lblNewLabel.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\pportal1.png"));
133 | lblNewLabel.setBounds(107, 314, 271, 247);
134 | }
135 | return lblNewLabel;
136 | }
137 | private JLabel getLblNewLabel_1() {
138 | if (lblNewLabel_1 == null) {
139 | lblNewLabel_1 = new JLabel("");
140 | lblNewLabel_1.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\pportal2.png"));
141 | lblNewLabel_1.setBounds(531, 314, 271, 247);
142 | }
143 | return lblNewLabel_1;
144 | }
145 | private JLabel getLblNewLabel_3() {
146 | if (lblNewLabel_3 == null) {
147 | lblNewLabel_3 = new JLabel("");
148 | lblNewLabel_3.addMouseListener(new MouseAdapter() {
149 | @Override
150 | public void mouseClicked(MouseEvent e) {
151 | new passengerLoginFrame().setVisible(true);
152 | dispose();
153 | }
154 | });
155 | lblNewLabel_3.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\back.png"));
156 | lblNewLabel_3.setBounds(815, 0, 73, 84);
157 | }
158 | return lblNewLabel_3;
159 | }
160 | private JLabel getTicketBooking() {
161 | if (ticketBooking == null) {
162 | ticketBooking = new JLabel("");
163 | ticketBooking.addMouseListener(new MouseAdapter() {
164 | @Override
165 | public void mouseClicked(MouseEvent e) {
166 | try {
167 | new ticketBooking().setVisible(true);
168 | } catch (IOException e1) {
169 | // TODO Auto-generated catch block
170 | e1.printStackTrace();
171 | }
172 | dispose();
173 | }
174 | });
175 | ticketBooking.setBounds(52, 129, 356, 476);
176 | }
177 | return ticketBooking;
178 | }
179 | private JLabel getTrainScreen() {
180 | if (trainScreen == null) {
181 | trainScreen = new JLabel("");
182 | trainScreen.addMouseListener(new MouseAdapter() {
183 | @Override
184 | public void mouseClicked(MouseEvent e) {
185 | try {
186 | new passengerTrainScreen().setVisible(true);
187 | dispose();
188 | } catch (IOException e1) {
189 | // TODO Auto-generated catch block
190 | e1.printStackTrace();
191 | }
192 |
193 | }
194 | });
195 | trainScreen.setBounds(479, 129, 356, 476);
196 | }
197 | return trainScreen;
198 | }
199 | }
200 |
--------------------------------------------------------------------------------
/src/view/officialLoginFrame.java:
--------------------------------------------------------------------------------
1 | package view;
2 |
3 | import java.awt.BorderLayout;
4 | import java.awt.EventQueue;
5 |
6 | import javax.swing.JFrame;
7 | import javax.swing.JPanel;
8 | import javax.swing.border.EmptyBorder;
9 |
10 | import data_structures.arrays;
11 |
12 | import java.awt.Color;
13 | import javax.swing.JSeparator;
14 | import javax.swing.JLabel;
15 | import javax.swing.JOptionPane;
16 |
17 | import java.awt.Font;
18 | import javax.swing.ImageIcon;
19 | import javax.swing.JTextField;
20 | import java.awt.event.MouseAdapter;
21 | import java.awt.event.MouseEvent;
22 | import java.io.IOException;
23 |
24 | import javax.swing.SwingConstants;
25 | import javax.swing.JPasswordField;
26 |
27 | public class officialLoginFrame extends JFrame {
28 |
29 | private JPanel contentPane;
30 | private JSeparator separator;
31 | private JLabel lblLogin;
32 | private JLabel lblNewLabel_2;
33 | private JLabel lblUsername;
34 | private JLabel lblPassword;
35 | private JLabel lblNewLabel;
36 | private JLabel lblNewLabel_3;
37 | private JLabel lblLogin_1;
38 | private JTextField username_txt;
39 | private JPasswordField password_txt;
40 | private arrays a = new arrays();
41 |
42 | /**
43 | * Launch the application.
44 | */
45 | public static void main(String[] args) {
46 | EventQueue.invokeLater(new Runnable() {
47 | public void run() {
48 | try {
49 | officialLoginFrame frame = new officialLoginFrame();
50 | frame.setVisible(true);
51 | } catch (Exception e) {
52 | e.printStackTrace();
53 | }
54 | }
55 | });
56 | }
57 |
58 | /**
59 | * Create the frame.
60 | */
61 | public officialLoginFrame() {
62 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
63 | setBounds(100, 100, 900, 700);
64 | contentPane = new JPanel();
65 | contentPane.setBackground(Color.decode("#2c3e50"));
66 | contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
67 | setContentPane(contentPane);
68 | contentPane.setLayout(null);
69 | contentPane.add(getPassword_txt());
70 | contentPane.add(getUsername_txt());
71 | contentPane.add(getLblLogin_1());
72 | contentPane.add(getLblNewLabel_3());
73 | contentPane.add(getLblPassword());
74 | contentPane.add(getLblUsername());
75 | contentPane.add(getSeparator());
76 | contentPane.add(getLblLogin());
77 | contentPane.add(getLblNewLabel_2());
78 | contentPane.add(getLblNewLabel());
79 | }
80 | private JSeparator getSeparator() {
81 | if (separator == null) {
82 | separator = new JSeparator();
83 | separator.setBounds(327, 76, 205, 13);
84 | }
85 | return separator;
86 | }
87 | private JLabel getLblLogin() {
88 | if (lblLogin == null) {
89 | lblLogin = new JLabel("LOGIN");
90 | lblLogin.setForeground(Color.WHITE);
91 | lblLogin.setFont(new Font("Press Start 2P", Font.BOLD, 30));
92 | lblLogin.setBounds(345, 11, 171, 84);
93 | }
94 | return lblLogin;
95 | }
96 | private JLabel getLblNewLabel_2() {
97 | if (lblNewLabel_2 == null) {
98 | lblNewLabel_2 = new JLabel("");
99 | lblNewLabel_2.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\index2.png"));
100 | lblNewLabel_2.setBounds(252, 108, 387, 499);
101 | }
102 | return lblNewLabel_2;
103 | }
104 | private JLabel getLblUsername() {
105 | if (lblUsername == null) {
106 | lblUsername = new JLabel("USERNAME");
107 | lblUsername.setHorizontalAlignment(SwingConstants.CENTER);
108 | lblUsername.setForeground(Color.BLACK);
109 | lblUsername.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
110 | lblUsername.setBounds(301, 167, 282, 46);
111 | }
112 | return lblUsername;
113 | }
114 | private JLabel getLblPassword() {
115 | if (lblPassword == null) {
116 | lblPassword = new JLabel("PASSWORD");
117 | lblPassword.setHorizontalAlignment(SwingConstants.CENTER);
118 | lblPassword.setForeground(Color.BLACK);
119 | lblPassword.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
120 | lblPassword.setBounds(301, 291, 282, 46);
121 | }
122 | return lblPassword;
123 | }
124 | private JLabel getLblNewLabel() {
125 | if (lblNewLabel == null) {
126 | lblNewLabel = new JLabel("");
127 | lblNewLabel.addMouseListener(new MouseAdapter() {
128 | @Override
129 | public void mouseClicked(MouseEvent e) {
130 | new index().setVisible(true);
131 | dispose();
132 | }
133 | });
134 | lblNewLabel.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\back.png"));
135 | lblNewLabel.setBounds(805, 11, 73, 84);
136 | }
137 | return lblNewLabel;
138 | }
139 | private JLabel getLblNewLabel_3() {
140 | if (lblNewLabel_3 == null) {
141 | lblNewLabel_3 = new JLabel("");
142 | lblNewLabel_3.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\index3.png"));
143 | lblNewLabel_3.setBounds(330, 416, 237, 77);
144 | }
145 | return lblNewLabel_3;
146 | }
147 | private JLabel getLblLogin_1() {
148 | if (lblLogin_1 == null) {
149 | lblLogin_1 = new JLabel("LOGIN");
150 | lblLogin_1.addMouseListener(new MouseAdapter() {
151 | @Override
152 | public void mouseClicked(MouseEvent e) {
153 |
154 | //validation
155 | if(username_txt.getText().isEmpty()) {
156 | JOptionPane.showMessageDialog(username_txt, "ENTER YOUR USERNAME");
157 | return;
158 | }
159 | if(password_txt.getText().isEmpty()) {
160 | JOptionPane.showMessageDialog(password_txt, "ENTER YOUR PASSWORD");
161 | return;
162 | }
163 |
164 | try {
165 | boolean login = a.getOfficials(username_txt.getText(), password_txt.getText());
166 | if(login) {
167 | new officialPortal().setVisible(true);
168 | dispose();
169 | }
170 | else {
171 | JOptionPane.showMessageDialog(password_txt, "INCORECT USERNAME OR PASSWORD");
172 | return;
173 | }
174 | } catch (IOException e1) {
175 | System.out.println("ERROR");
176 | e1.printStackTrace();
177 | }
178 |
179 | }
180 | });
181 | lblLogin_1.setHorizontalAlignment(SwingConstants.CENTER);
182 | lblLogin_1.setForeground(Color.BLACK);
183 | lblLogin_1.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
184 | lblLogin_1.setBounds(330, 416, 237, 77);
185 | }
186 | return lblLogin_1;
187 | }
188 | private JTextField getUsername_txt() {
189 | if (username_txt == null) {
190 | username_txt = new JTextField();
191 | username_txt.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
192 | username_txt.setColumns(10);
193 | username_txt.setBounds(301, 223, 282, 57);
194 | }
195 | return username_txt;
196 | }
197 | private JPasswordField getPassword_txt() {
198 | if (password_txt == null) {
199 | password_txt = new JPasswordField();
200 | password_txt.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
201 | password_txt.setBounds(301, 348, 283, 57);
202 | }
203 | return password_txt;
204 | }
205 | }
206 |
--------------------------------------------------------------------------------
/src/view/ticketView.java:
--------------------------------------------------------------------------------
1 | package view;
2 |
3 | import java.awt.BorderLayout;
4 | import java.awt.EventQueue;
5 |
6 | import javax.swing.JFrame;
7 | import javax.swing.JPanel;
8 | import javax.swing.border.EmptyBorder;
9 |
10 | import data_structures.arrays;
11 | import data_structures.fileHandler;
12 |
13 | import java.awt.Color;
14 | import javax.swing.JSeparator;
15 | import javax.swing.JLabel;
16 | import java.awt.Font;
17 | import javax.swing.ImageIcon;
18 | import javax.swing.JTextField;
19 | import java.awt.event.MouseAdapter;
20 | import java.awt.event.MouseEvent;
21 | import java.io.IOException;
22 |
23 | import javax.swing.SwingConstants;
24 | import javax.swing.JButton;
25 | import java.awt.event.ActionListener;
26 | import java.awt.event.ActionEvent;
27 |
28 | public class ticketView extends JFrame {
29 |
30 | private JPanel contentPane;
31 | private JSeparator separator;
32 | private JLabel lblLogin;
33 | private JLabel lblNewLabel;
34 | private JLabel lblNewLabel_1;
35 | private JLabel name_txt;
36 | private JLabel lblNewLabel_2;
37 | private JLabel train_txt;
38 | private JLabel date_txt;
39 | private JLabel price_txt;
40 | private JLabel count_txt;
41 | private JLabel from_txt;
42 | private JLabel to_txt;
43 |
44 | /**
45 | * Launch the application.
46 | */
47 | public static void main(String[] args) {
48 | EventQueue.invokeLater(new Runnable() {
49 | public void run() {
50 | try {
51 | ticketView frame = new ticketView();
52 | frame.setVisible(true);
53 | } catch (Exception e) {
54 | e.printStackTrace();
55 | }
56 | }
57 | });
58 | }
59 |
60 | /**
61 | * Create the frame.
62 | * @throws IOException
63 | */
64 | public ticketView() throws IOException{
65 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
66 | setBounds(100, 100, 900, 700);
67 | contentPane = new JPanel();
68 | contentPane.setBackground(Color.decode("#2c3e50"));
69 | contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
70 | setContentPane(contentPane);
71 | contentPane.setLayout(null);
72 | contentPane.add(getTo_txt());
73 | contentPane.add(getFrom_txt());
74 | contentPane.add(getCount_txt());
75 | contentPane.add(getPrice_txt());
76 | contentPane.add(getDate_txt());
77 | contentPane.add(getTrain_txt());
78 | contentPane.add(getLblNewLabel());
79 | contentPane.add(getLblNewLabel_2());
80 | contentPane.add(getName_txt());
81 | contentPane.add(getSeparator());
82 | contentPane.add(getLblLogin());
83 | contentPane.add(getLblNewLabel_1());
84 | fillTicket();
85 |
86 | }
87 | private JSeparator getSeparator() {
88 | if (separator == null) {
89 | separator = new JSeparator();
90 | separator.setBounds(327, 76, 205, 13);
91 | }
92 | return separator;
93 | }
94 | private JLabel getLblLogin() {
95 | if (lblLogin == null) {
96 | lblLogin = new JLabel("BOOKED");
97 | lblLogin.setHorizontalAlignment(SwingConstants.CENTER);
98 | lblLogin.setForeground(Color.WHITE);
99 | lblLogin.setFont(new Font("Press Start 2P", Font.BOLD, 30));
100 | lblLogin.setBounds(327, 11, 205, 84);
101 | }
102 | return lblLogin;
103 | }
104 | private JLabel getLblNewLabel() {
105 | if (lblNewLabel == null) {
106 | lblNewLabel = new JLabel("");
107 | lblNewLabel.addMouseListener(new MouseAdapter() {
108 | @Override
109 | public void mouseClicked(MouseEvent e) {
110 | new passengerPortal().setVisible(true);
111 | dispose();
112 | }
113 | });
114 | lblNewLabel.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\back.png"));
115 | lblNewLabel.setBounds(805, 11, 73, 84);
116 | }
117 | return lblNewLabel;
118 | }
119 | private JLabel getLblNewLabel_1() {
120 | if (lblNewLabel_1 == null) {
121 | lblNewLabel_1 = new JLabel("");
122 | lblNewLabel_1.setHorizontalAlignment(SwingConstants.CENTER);
123 | lblNewLabel_1.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\ticketView1.png"));
124 | lblNewLabel_1.setBounds(10, 76, 868, 527);
125 | }
126 | return lblNewLabel_1;
127 | }
128 | private JLabel getName_txt() {
129 | if (name_txt == null) {
130 | name_txt = new JLabel("NAME:");
131 | name_txt.setHorizontalAlignment(SwingConstants.LEFT);
132 | name_txt.setForeground(Color.WHITE);
133 | name_txt.setFont(new Font("Press Start 2P", Font.BOLD, 20));
134 | name_txt.setBounds(115, 127, 664, 50);
135 | }
136 | return name_txt;
137 | }
138 | private JLabel getLblNewLabel_2() {
139 | if (lblNewLabel_2 == null) {
140 | lblNewLabel_2 = new JLabel("");
141 | lblNewLabel_2.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\ticketView2.png"));
142 | lblNewLabel_2.setBounds(628, 237, 138, 159);
143 | }
144 | return lblNewLabel_2;
145 | }
146 |
147 | void showTicket() throws IOException {
148 | String arr[] = arrays.getTicket();
149 |
150 | }
151 | private JLabel getTrain_txt() {
152 | if (train_txt == null) {
153 | train_txt = new JLabel("TRAIN:");
154 | train_txt.setHorizontalAlignment(SwingConstants.LEFT);
155 | train_txt.setForeground(Color.WHITE);
156 | train_txt.setFont(new Font("Press Start 2P", Font.BOLD, 20));
157 | train_txt.setBounds(115, 188, 664, 50);
158 | }
159 | return train_txt;
160 | }
161 | private JLabel getDate_txt() {
162 | if (date_txt == null) {
163 | date_txt = new JLabel("DATE:");
164 | date_txt.setHorizontalAlignment(SwingConstants.LEFT);
165 | date_txt.setForeground(Color.WHITE);
166 | date_txt.setFont(new Font("Press Start 2P", Font.BOLD, 20));
167 | date_txt.setBounds(115, 249, 503, 50);
168 | }
169 | return date_txt;
170 | }
171 | private JLabel getPrice_txt() {
172 | if (price_txt == null) {
173 | price_txt = new JLabel("PRICE:");
174 | price_txt.setHorizontalAlignment(SwingConstants.LEFT);
175 | price_txt.setForeground(Color.WHITE);
176 | price_txt.setFont(new Font("Press Start 2P", Font.BOLD, 20));
177 | price_txt.setBounds(115, 310, 503, 50);
178 | }
179 | return price_txt;
180 | }
181 | private JLabel getCount_txt() {
182 | if (count_txt == null) {
183 | count_txt = new JLabel("COUNT:");
184 | count_txt.setHorizontalAlignment(SwingConstants.LEFT);
185 | count_txt.setForeground(Color.WHITE);
186 | count_txt.setFont(new Font("Press Start 2P", Font.BOLD, 20));
187 | count_txt.setBounds(115, 371, 503, 50);
188 | }
189 | return count_txt;
190 | }
191 | private JLabel getFrom_txt() {
192 | if (from_txt == null) {
193 | from_txt = new JLabel("FROM:");
194 | from_txt.setHorizontalAlignment(SwingConstants.LEFT);
195 | from_txt.setForeground(Color.WHITE);
196 | from_txt.setFont(new Font("Press Start 2P", Font.BOLD, 20));
197 | from_txt.setBounds(115, 432, 651, 50);
198 | }
199 | return from_txt;
200 | }
201 | private JLabel getTo_txt() {
202 | if (to_txt == null) {
203 | to_txt = new JLabel("TO: ");
204 | to_txt.setHorizontalAlignment(SwingConstants.LEFT);
205 | to_txt.setForeground(Color.WHITE);
206 | to_txt.setFont(new Font("Press Start 2P", Font.BOLD, 20));
207 | to_txt.setBounds(115, 496, 651, 50);
208 | }
209 | return to_txt;
210 | }
211 |
212 | public void fillTicket() throws IOException {
213 | String[] arr = arrays.getTicket();
214 | from_txt.setText(from_txt.getText()+" "+arr[0]);
215 | to_txt.setText(to_txt.getText()+" "+arr[1]);
216 | date_txt.setText(date_txt.getText()+" "+arr[2]);
217 | name_txt.setText(name_txt.getText()+" "+arr[3]);
218 | count_txt.setText(count_txt.getText()+" "+arr[4]);
219 | train_txt.setText(train_txt.getText()+" "+arr[5]);
220 | price_txt.setText(price_txt.getText()+" "+arr[6]);
221 | }
222 | }
223 |
--------------------------------------------------------------------------------
/src/view/passengerRegisterFrame.java:
--------------------------------------------------------------------------------
1 | package view;
2 |
3 | import java.awt.BorderLayout;
4 | import java.awt.EventQueue;
5 |
6 | import javax.swing.JFrame;
7 | import javax.swing.JPanel;
8 | import javax.swing.border.EmptyBorder;
9 |
10 | import data_structures.arrays;
11 |
12 | import java.awt.Color;
13 | import javax.swing.JSeparator;
14 | import javax.swing.JLabel;
15 | import javax.swing.JOptionPane;
16 |
17 | import java.awt.Font;
18 | import javax.swing.ImageIcon;
19 | import javax.swing.JTextField;
20 | import java.awt.event.MouseAdapter;
21 | import java.awt.event.MouseEvent;
22 | import java.io.IOException;
23 |
24 | import javax.swing.SwingConstants;
25 |
26 | public class passengerRegisterFrame extends JFrame {
27 |
28 | private JPanel contentPane;
29 | private JSeparator separator;
30 | private JLabel lblLogin;
31 | private JLabel lblNewLabel_2;
32 | private JLabel lblUsername;
33 | private JLabel lblPassword;
34 | private JLabel lblNewLabel;
35 | private JLabel lblNewLabel_3;
36 | private JLabel lblLogin_1;
37 | private JLabel lblPassword_1;
38 | private JTextField name_txt;
39 | private JTextField username_txt;
40 | private JTextField password_txt;
41 | private arrays a = new arrays();
42 |
43 | /**
44 | * Launch the application.
45 | */
46 | public static void main(String[] args) {
47 | EventQueue.invokeLater(new Runnable() {
48 | public void run() {
49 | try {
50 | passengerRegisterFrame frame = new passengerRegisterFrame();
51 | frame.setVisible(true);
52 | } catch (Exception e) {
53 | e.printStackTrace();
54 | }
55 | }
56 | });
57 | }
58 |
59 | /**
60 | * Create the frame.
61 | */
62 | public passengerRegisterFrame() {
63 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
64 | setBounds(100, 100, 900, 700);
65 | contentPane = new JPanel();
66 | contentPane.setBackground(Color.decode("#2c3e50"));
67 | contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
68 | setContentPane(contentPane);
69 | contentPane.setLayout(null);
70 | contentPane.add(getTextField_2_1());
71 | contentPane.add(getTextField_1_1());
72 | contentPane.add(getTextField_3());
73 | contentPane.add(getLblPassword_1());
74 | contentPane.add(getLblLogin_1());
75 | contentPane.add(getLblNewLabel_3());
76 | contentPane.add(getLblPassword());
77 | contentPane.add(getLblUsername());
78 | contentPane.add(getSeparator());
79 | contentPane.add(getLblLogin());
80 | contentPane.add(getLblNewLabel_2());
81 | contentPane.add(getLblNewLabel());
82 | }
83 | private JSeparator getSeparator() {
84 | if (separator == null) {
85 | separator = new JSeparator();
86 | separator.setBounds(290, 76, 293, 13);
87 | }
88 | return separator;
89 | }
90 | private JLabel getLblLogin() {
91 | if (lblLogin == null) {
92 | lblLogin = new JLabel("REGISTER");
93 | lblLogin.setForeground(Color.WHITE);
94 | lblLogin.setFont(new Font("Press Start 2P", Font.BOLD, 30));
95 | lblLogin.setBounds(315, 11, 249, 84);
96 | }
97 | return lblLogin;
98 | }
99 | private JLabel getLblNewLabel_2() {
100 | if (lblNewLabel_2 == null) {
101 | lblNewLabel_2 = new JLabel("");
102 | lblNewLabel_2.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\index2.png"));
103 | lblNewLabel_2.setBounds(252, 108, 387, 499);
104 | }
105 | return lblNewLabel_2;
106 | }
107 | private JLabel getLblUsername() {
108 | if (lblUsername == null) {
109 | lblUsername = new JLabel("NAME");
110 | lblUsername.setHorizontalAlignment(SwingConstants.CENTER);
111 | lblUsername.setForeground(Color.BLACK);
112 | lblUsername.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
113 | lblUsername.setBounds(301, 118, 282, 46);
114 | }
115 | return lblUsername;
116 | }
117 | private JLabel getLblPassword() {
118 | if (lblPassword == null) {
119 | lblPassword = new JLabel("USERNAME");
120 | lblPassword.setHorizontalAlignment(SwingConstants.CENTER);
121 | lblPassword.setForeground(Color.BLACK);
122 | lblPassword.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
123 | lblPassword.setBounds(301, 231, 282, 46);
124 | }
125 | return lblPassword;
126 | }
127 | private JLabel getLblNewLabel() {
128 | if (lblNewLabel == null) {
129 | lblNewLabel = new JLabel("");
130 | lblNewLabel.addMouseListener(new MouseAdapter() {
131 | @Override
132 | public void mouseClicked(MouseEvent e) {
133 | new index().setVisible(true);
134 | dispose();
135 | }
136 | });
137 | lblNewLabel.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\back.png"));
138 | lblNewLabel.setBounds(805, 11, 73, 84);
139 | }
140 | return lblNewLabel;
141 | }
142 | private JLabel getLblNewLabel_3() {
143 | if (lblNewLabel_3 == null) {
144 | lblNewLabel_3 = new JLabel("");
145 | lblNewLabel_3.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\index3.png"));
146 | lblNewLabel_3.setBounds(327, 460, 237, 77);
147 | }
148 | return lblNewLabel_3;
149 | }
150 | private JLabel getLblLogin_1() {
151 | if (lblLogin_1 == null) {
152 | lblLogin_1 = new JLabel("REGISTER");
153 | lblLogin_1.addMouseListener(new MouseAdapter() {
154 | @Override
155 | public void mouseClicked(MouseEvent e) {
156 |
157 | //validation
158 | String name = name_txt.getText();
159 | String username = username_txt.getText();
160 | String password = password_txt.getText();
161 | if(name.isEmpty()) {
162 | JOptionPane.showMessageDialog(name_txt, "ENTER YOUR NAME");
163 | return;
164 | }
165 | if(username.isEmpty()) {
166 | JOptionPane.showMessageDialog(username_txt, "ENTER YOUR USERNAME");
167 | return;
168 | }
169 | if(password.isEmpty()) {
170 | JOptionPane.showMessageDialog(password_txt, "ENTER YOUR PASSWORD");
171 | return;
172 | }
173 |
174 | try {
175 | //if login successful
176 | if(a.setPassengers(name, username, password)) {
177 | JOptionPane.showMessageDialog(password_txt, "SUCCESSFULLY REGISTERED");
178 | //now login
179 | new passengerLoginFrame().setVisible(true);
180 | dispose();
181 | return;
182 | }
183 | else {
184 | JOptionPane.showMessageDialog(username_txt, "USERNAME ALREADY USED");
185 | return;
186 | }
187 | } catch (IOException e1) {
188 | // TODO Auto-generated catch block
189 | e1.printStackTrace();
190 | }
191 |
192 |
193 | }
194 | });
195 | lblLogin_1.setHorizontalAlignment(SwingConstants.CENTER);
196 | lblLogin_1.setForeground(Color.BLACK);
197 | lblLogin_1.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
198 | lblLogin_1.setBounds(327, 464, 237, 61);
199 | }
200 | return lblLogin_1;
201 | }
202 | private JLabel getLblPassword_1() {
203 | if (lblPassword_1 == null) {
204 | lblPassword_1 = new JLabel("PASSWORD");
205 | lblPassword_1.setHorizontalAlignment(SwingConstants.CENTER);
206 | lblPassword_1.setForeground(Color.BLACK);
207 | lblPassword_1.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
208 | lblPassword_1.setBounds(301, 338, 282, 46);
209 | }
210 | return lblPassword_1;
211 | }
212 | private JTextField getTextField_3() {
213 | if (name_txt == null) {
214 | name_txt = new JTextField();
215 | name_txt.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
216 | name_txt.setColumns(10);
217 | name_txt.setBounds(301, 164, 282, 57);
218 | }
219 | return name_txt;
220 | }
221 | private JTextField getTextField_1_1() {
222 | if (username_txt == null) {
223 | username_txt = new JTextField();
224 | username_txt.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
225 | username_txt.setColumns(10);
226 | username_txt.setBounds(301, 274, 282, 57);
227 | }
228 | return username_txt;
229 | }
230 | private JTextField getTextField_2_1() {
231 | if (password_txt == null) {
232 | password_txt = new JTextField();
233 | password_txt.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
234 | password_txt.setColumns(10);
235 | password_txt.setBounds(301, 395, 282, 57);
236 | }
237 | return password_txt;
238 | }
239 | }
240 |
--------------------------------------------------------------------------------
/src/view/passengerLoginFrame.java:
--------------------------------------------------------------------------------
1 | package view;
2 |
3 | import java.awt.BorderLayout;
4 | import java.awt.EventQueue;
5 |
6 | import javax.swing.JFrame;
7 | import javax.swing.JPanel;
8 | import javax.swing.border.EmptyBorder;
9 |
10 | import data_structures.arrays;
11 |
12 | import java.awt.Color;
13 | import javax.swing.JSeparator;
14 | import javax.swing.JLabel;
15 | import javax.swing.JOptionPane;
16 |
17 | import java.awt.Font;
18 | import javax.swing.ImageIcon;
19 | import javax.swing.JTextField;
20 | import java.awt.event.MouseAdapter;
21 | import java.awt.event.MouseEvent;
22 | import java.io.IOException;
23 |
24 | import javax.swing.SwingConstants;
25 | import javax.swing.JPasswordField;
26 |
27 | public class passengerLoginFrame extends JFrame {
28 |
29 | private JPanel contentPane;
30 | private JSeparator separator;
31 | private JLabel lblLogin;
32 | private JLabel lblNewLabel_2;
33 | private JTextField username_txt;
34 | private JLabel lblUsername;
35 | private JLabel lblPassword;
36 | private JLabel lblIfYouDont;
37 | private JLabel lblRegisterNow;
38 | private JLabel lblNewLabel;
39 | private JLabel lblNewLabel_3;
40 | private JLabel lblLogin_1;
41 | private JPasswordField password_txt;
42 | private arrays a = new arrays();
43 |
44 | /**
45 | * Launch the application.
46 | */
47 | public static void main(String[] args) {
48 | EventQueue.invokeLater(new Runnable() {
49 | public void run() {
50 | try {
51 | passengerLoginFrame frame = new passengerLoginFrame();
52 | frame.setVisible(true);
53 | } catch (Exception e) {
54 | e.printStackTrace();
55 | }
56 | }
57 | });
58 | }
59 |
60 | /**
61 | * Create the frame.
62 | */
63 | public passengerLoginFrame() {
64 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
65 | setBounds(100, 100, 900, 700);
66 | contentPane = new JPanel();
67 | contentPane.setBackground(Color.decode("#2c3e50"));
68 | contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
69 | setContentPane(contentPane);
70 | contentPane.setLayout(null);
71 | contentPane.add(getPassword_txt());
72 | contentPane.add(getLblLogin_1());
73 | contentPane.add(getLblNewLabel_3());
74 | contentPane.add(getLblRegisterNow());
75 | contentPane.add(getLblIfYouDont());
76 | contentPane.add(getLblPassword());
77 | contentPane.add(getLblUsername());
78 | contentPane.add(getUsername_txt());
79 | contentPane.add(getSeparator());
80 | contentPane.add(getLblLogin());
81 | contentPane.add(getLblNewLabel_2());
82 | contentPane.add(getLblNewLabel());
83 | }
84 | private JSeparator getSeparator() {
85 | if (separator == null) {
86 | separator = new JSeparator();
87 | separator.setBounds(327, 76, 205, 13);
88 | }
89 | return separator;
90 | }
91 | private JLabel getLblLogin() {
92 | if (lblLogin == null) {
93 | lblLogin = new JLabel("LOGIN");
94 | lblLogin.setForeground(Color.WHITE);
95 | lblLogin.setFont(new Font("Press Start 2P", Font.BOLD, 30));
96 | lblLogin.setBounds(345, 11, 171, 84);
97 | }
98 | return lblLogin;
99 | }
100 | private JLabel getLblNewLabel_2() {
101 | if (lblNewLabel_2 == null) {
102 | lblNewLabel_2 = new JLabel("");
103 | lblNewLabel_2.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\index2.png"));
104 | lblNewLabel_2.setBounds(252, 108, 387, 499);
105 | }
106 | return lblNewLabel_2;
107 | }
108 | private JTextField getUsername_txt() {
109 | if (username_txt == null) {
110 | username_txt = new JTextField();
111 | username_txt.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
112 | username_txt.setBounds(301, 223, 282, 57);
113 | username_txt.setColumns(10);
114 | }
115 | return username_txt;
116 | }
117 | private JLabel getLblUsername() {
118 | if (lblUsername == null) {
119 | lblUsername = new JLabel("USERNAME");
120 | lblUsername.setHorizontalAlignment(SwingConstants.CENTER);
121 | lblUsername.setForeground(Color.BLACK);
122 | lblUsername.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
123 | lblUsername.setBounds(301, 167, 282, 46);
124 | }
125 | return lblUsername;
126 | }
127 | private JLabel getLblPassword() {
128 | if (lblPassword == null) {
129 | lblPassword = new JLabel("PASSWORD");
130 | lblPassword.setHorizontalAlignment(SwingConstants.CENTER);
131 | lblPassword.setForeground(Color.BLACK);
132 | lblPassword.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
133 | lblPassword.setBounds(301, 291, 282, 46);
134 | }
135 | return lblPassword;
136 | }
137 | private JLabel getLblIfYouDont() {
138 | if (lblIfYouDont == null) {
139 | lblIfYouDont = new JLabel("If you don't have an account");
140 | lblIfYouDont.setHorizontalAlignment(SwingConstants.CENTER);
141 | lblIfYouDont.setForeground(Color.BLACK);
142 | lblIfYouDont.setFont(new Font("Press Start 2P", Font.PLAIN, 10));
143 | lblIfYouDont.setBounds(264, 490, 352, 36);
144 | }
145 | return lblIfYouDont;
146 | }
147 | private JLabel getLblRegisterNow() {
148 | if (lblRegisterNow == null) {
149 | lblRegisterNow = new JLabel("Register Now");
150 | lblRegisterNow.addMouseListener(new MouseAdapter() {
151 | @Override
152 | public void mouseClicked(MouseEvent e) {
153 | //open register panel
154 | new passengerRegisterFrame().setVisible(true);
155 | dispose();
156 | }
157 | });
158 | lblRegisterNow.setHorizontalAlignment(SwingConstants.CENTER);
159 | lblRegisterNow.setForeground(Color.GRAY);
160 | lblRegisterNow.setFont(new Font("Press Start 2P", Font.PLAIN, 10));
161 | lblRegisterNow.setBounds(264, 520, 352, 29);
162 | }
163 | return lblRegisterNow;
164 | }
165 | private JLabel getLblNewLabel() {
166 | if (lblNewLabel == null) {
167 | lblNewLabel = new JLabel("");
168 | lblNewLabel.addMouseListener(new MouseAdapter() {
169 | @Override
170 | public void mouseClicked(MouseEvent e) {
171 | new index().setVisible(true);
172 | dispose();
173 | }
174 | });
175 | lblNewLabel.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\back.png"));
176 | lblNewLabel.setBounds(805, 11, 73, 84);
177 | }
178 | return lblNewLabel;
179 | }
180 | private JLabel getLblNewLabel_3() {
181 | if (lblNewLabel_3 == null) {
182 | lblNewLabel_3 = new JLabel("");
183 | lblNewLabel_3.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\index3.png"));
184 | lblNewLabel_3.setBounds(330, 416, 237, 77);
185 | }
186 | return lblNewLabel_3;
187 | }
188 | private JLabel getLblLogin_1() {
189 | if (lblLogin_1 == null) {
190 | lblLogin_1 = new JLabel("LOGIN");
191 | lblLogin_1.addMouseListener(new MouseAdapter() {
192 | @Override
193 | public void mouseClicked(MouseEvent e) {
194 |
195 | //validation
196 | if(username_txt.getText().isEmpty()) {
197 | JOptionPane.showMessageDialog(username_txt, "ENTER YOUR USERNAME");
198 | return;
199 | }
200 | if(password_txt.getText().isEmpty()) {
201 | JOptionPane.showMessageDialog(password_txt, "ENTER YOUR PASSWORD");
202 | return;
203 | }
204 |
205 | try {
206 | //if the login informations match
207 | boolean login = a.getPassengers(username_txt.getText(), password_txt.getText());
208 | if(login) {
209 | //open passenger portal after login
210 | new passengerPortal().setVisible(true);
211 | dispose();
212 | }
213 | else {
214 | //if incorrect username
215 | JOptionPane.showMessageDialog(password_txt, "INCORECT USERNAME OR PASSWORD");
216 | return;
217 | }
218 | } catch (IOException e1) {
219 | System.out.println("ERROR");
220 | e1.printStackTrace();
221 | }
222 |
223 |
224 | }
225 | });
226 | lblLogin_1.setHorizontalAlignment(SwingConstants.CENTER);
227 | lblLogin_1.setForeground(Color.BLACK);
228 | lblLogin_1.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
229 | lblLogin_1.setBounds(330, 416, 229, 77);
230 | }
231 | return lblLogin_1;
232 | }
233 | private JPasswordField getPassword_txt() {
234 | if (password_txt == null) {
235 | password_txt = new JPasswordField();
236 | password_txt.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
237 | password_txt.setBounds(301, 348, 283, 57);
238 | }
239 | return password_txt;
240 | }
241 | }
242 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## RAILWAY MANAGEMENT SYSTEM
2 |
3 | **Project report submitted to the Amrita Vishwa Vidyapeetham in partial fulfilment of the
4 | requirement for the Degree of
5 | B.Tech. Computer Science and Engineering
6 | Artificial Intelligence**
7 |
8 | ```
9 | Submitted by:
10 | Abhinav Pandey (AM.EN.U4AIE21088)
11 | Abhishek. A. (AM.EN.U4AIE21003)
12 | Anfas Hassan V (AM.EN.U4AIE21014)
13 | Aravind MJ (AM.EN.U4AIE21017)
14 | Rithesh R (AM.EN.U4AIE21054)
15 | D.S.S. Sandeep Chandra (AM.EN.U4AIE21079)
16 | ```
17 |
18 |
19 |
20 | **DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING AMRITA VISHWA
21 | VIDYAPEETHAM
22 | (Estd. U/S 3 of the UGC Act 1956)
23 | Amritapuri Campus Kollam -**
24 |
25 | ## DECLARATION
26 |
27 | ```
28 | We, Abhinav Pandey, Abishek A., Anfas Hassan, Aravind MJ, Rithesh R, D.S.S.
29 | Sandeep Chandra hereby declare that this project entitled Railway Management
30 | System is a record of the original work done by usunder the guidance of Smt Akshara P
31 | Byju Dept. of Computer Science and Engineering, AmritaVishwa Vidyapeetham, that this
32 | work has not formed the basis for any degree/diploma/associations/fellowship or similar
33 | awards to any candidate in any university to the best of our knowledge.
34 | ```
35 |
36 | Place: Amritapuri Date: 12 July 2022
37 |
38 | Signature of the student Signature of the Project Guide
39 |
40 | ## ACKNOWLEDGMENTS
41 |
42 | ### Humble pranams at the lotus feet of Amma, Sri Mata
43 |
44 | ### Amritanandamayi devi
45 |
46 | We thank Akshara P Byju, Department of Computer Science and Engineering, Amrita
47 | Vishwa Vidyapeetham, for her timely advice and constructive suggestions. We thank the
48 | faculty of the CSE Department for giving us an opportunity to explore our capabilities and
49 | widen our knowledge. We also thank our team members for their cooperation and hard
50 | work put into this project. We also thank our batch mates for their support and our parents
51 | for their support and encouragement.
52 |
53 | ## ABSTRACT
54 |
55 | The Indian Railways (IR) carries about 5.5 lakhs passengers in reserved accommodation
56 | every day. The Computerised Passenger Reservation System (PRS) facilitates the booking
57 | and cancellation of tickets from any of the 4000 terminals (i.e. PRS booking window all
58 | over the countries). These tickets can be booked or cancelled for journeys commencing in
59 | any part of India and ending in any other part, with travel time as long as 72hours and
60 | distance up to several thousand kilometres. In the given project we will be developing a
61 | desktop app which will help users to find train details, book and exact rates of their tickets
62 | to the desired destination. It is a combined app for both railway officials and passengers.
63 | The railway officials can control the flow of trains in the station and display them on screen.
64 | It is a complete railway management app that uses many data structures such as arrays,
65 | linked list and queue.
66 |
67 | ## INTRODUCTION
68 |
69 | Every Indian can proudly say that the Indian Railway is the world's second
70 | largest railway system.If going by figures it covers 6853 stations and 63028
71 | kilometres of track distance,carrying a load of 37840 passengers and around 500
72 | tons of freight annually. With this huge magnitude our railway system faced a
73 | problem of a complete and fast reservation system and was formed around the
74 | objective of providing reserved reservation to the train travellers.
75 |
76 | We are introducing the reserved ticketing in terminals and interactive live report
77 | of the train arrival response systems on touch screens.In the given project we
78 | will be developing a desktop app which will help users to find train details, book
79 | and exact rates of their tickets to the desired destination. It is a combined app for
80 | both railway officials and passengers. The railway officials can control the flow
81 | of trains in the station and display them on screen. It is a complete railway
82 | management app that uses many data structures such as arrays, linked list and
83 | queue.
84 |
85 | ### 1.1 Product Scope:
86 |
87 | ```
88 | ● Access to train timings
89 | ● Online ticket booking
90 | ● Manage incoming or late trains
91 | ```
92 |
93 | ### 1.2 Objectives:
94 |
95 | ```
96 | ● The main aim of this system is to manage the passenger ticket
97 | booking as well as the arrangement of train arrival timings.
98 | ● The train timings as we see on the screen in a railway station will
99 | be seen on the app in the passenger portal.
100 | ● On the other hand the railway officials get the train timings and
101 | display it on the screen.
102 | ```
103 |
104 | ● If one train is late the official will manage the timings and change
105 | it on the screen.
106 | ● The final product is a system that has two portals for passengers
107 | and railway officials, one shared screen between two and use of
108 | data structures such as linked lists, queue, arrays, priority queue,
109 | etc.
110 |
111 | ## FEASIBILITY STUDY
112 |
113 | ### Product Features:
114 |
115 | ● Passenger login/register
116 | (Username, Password)
117 | ● Train booking
118 |
119 | 1. Form
120 | ❖ Name
121 | ❖ Date
122 | ❖ From/to
123 | ❖ No of tickets
124 | ❖ Train Name
125 | ❖ Price
126 | 2. Train Screen
127 | (See the train timings)
128 |
129 | ● Officials login
130 | (Username, Password)
131 | ❖ Take train and timing as input
132 | ❖ Input in Train queue
133 | ❖ Remove from queue if train is late and add in new queue
134 | ❖ Add to main train queue if the late train is now on time
135 |
136 | ### Use case:
137 |
138 | Actors:
139 |
140 | ● Passenger Can
141 | register, book a train ticket and get
142 | the ticket at last. They can also see the
143 | trains which are currently coming to the
144 | train station.
145 |
146 | ● Railway Official
147 | Can get the information about incoming
148 | trains. They can remove the train from
149 | the train screen if the train is late and put
150 | it back to the screen if the information
151 | was wrong.
152 |
153 | ## SYSTEM REQUIREMENT
154 |
155 | ## Data Structures Used:
156 |
157 | **Linked Lists: (Train Screen)**
158 | A linked list is a linear data structure, in which the elements are not stored
159 | at contiguous memory locations. The elements in a linked list are linked
160 | using pointers.
161 | We have implemented linked lists in our program in the main train screen.
162 | Every train is a line one after another, we represent every train as a node in
163 | the linked list.
164 | We have used different methods like:
165 | ● deleteFromBeginning - When a train leaves the station
166 | ● insertFromBack - When a train is coming to the station
167 | ● deleteFromMiddle - When a train is coming late
168 | ● insertAtMiddle - If a train was removed from the list but the
169 | information was wrong we can add back at its same position
170 |
171 | **Queue: (Store late coming trains)**
172 | A Queue is a linear structure which follows a particular order in which the
173 | operations are performed. We can only insert from the back and remove
174 | from the top.
175 | We have implemented a queue to store late coming trains. If a train is
176 | coming late, we remove it from the main screen and put it in the queue. If
177 | another train follows it, that train will also be added to the queue. And
178 | when it is coming to the station, we remove it from the queue and insert it
179 | in the linked list.
180 | We have use different methods like:
181 | ● Enqueue
182 |
183 | ● Dequeue
184 |
185 | **Arrays: (Login and register information)**
186 | An array is a collection of items stored at contiguous memory locations. We
187 | have used 2D-arrays for storing the username and password of both the
188 |
189 | passengers and officials.
190 |
191 | ## SYSTEM ENVIRONMENT
192 |
193 | ### (INTERFACE)
194 |
195 | ● Passenger needs to register with the system before using the portal
196 | ● Passenger need to login to with registered id to access the portal
197 | ● Passenger should input all the details like name, date, train to book a
198 | ticket
199 | ● Railway officials need the input the train and timing in the train screen
200 | ● Railway officials get the information if a train is late and remove from
201 | the screen
202 | ● Railway officials can put the train back in its original timing if
203 | information is wrong
204 |
205 | ## (SOFTWARE)
206 |
207 | ● JDK 8 or higher
208 | ● IDE for java
209 | ● Java Swing GUI Library
210 | ● Windows Builder Editor
211 |
212 | ### (HARDWARE)
213 |
214 | ● Hard Disk 20GB
215 | ● Memory 2GB of RAM
216 | ● Processor Intel® i
217 | ● CPU 2GHz
218 |
219 | ## CONCLUSION
220 |
221 | 6.1 Summary of Achievements
222 | The following achievements were made during the project:
223 | ● Learned about implementing data structures in real life project
224 | ● Learned to handle csv files
225 | ● Learned to manage and use Swing library
226 | ● Learning about the different phases of software development and
227 | the software engineering processes involved in the development
228 | of software
229 |
230 | 6.2 Main difficulties encountered
231 | ● Handling csv files
232 | ● Converting stored files into data structures and passing it
233 | ● Time constraint
234 | 6.3 Limitations of the Project
235 | ● Print ticket option is not provided here
236 | ● Database could have been used
237 |
238 | ## SOURCE CODE
239 |
240 | ```
241 | Github link:
242 | https://github.com/Abhinavxox/Railway-Management-System
243 | ```
244 |
--------------------------------------------------------------------------------
/src/view/passengerTrainScreen.java:
--------------------------------------------------------------------------------
1 | package view;
2 |
3 | import java.awt.BorderLayout;
4 | import java.awt.Color;
5 | import java.awt.EventQueue;
6 |
7 | import javax.swing.JFrame;
8 | import javax.swing.JPanel;
9 | import javax.swing.border.EmptyBorder;
10 | import javax.swing.JLabel;
11 | import javax.swing.ImageIcon;
12 | import java.awt.Font;
13 | import javax.swing.SwingConstants;
14 | import java.awt.event.MouseAdapter;
15 | import java.awt.event.MouseEvent;
16 | import java.io.IOException;
17 | import java.util.ArrayList;
18 |
19 | import javax.swing.JTable;
20 | import javax.swing.table.DefaultTableModel;
21 |
22 | import data_structures.arrays;
23 |
24 | public class passengerTrainScreen extends JFrame {
25 |
26 | private JPanel contentPane;
27 | private JLabel lblNewLabel_3;
28 | private JLabel lblNewLabel;
29 | private JLabel lblNewLabel_1;
30 | private JLabel lblNewLabel_1_1;
31 | private JLabel lblNewLabel_1_1_1;
32 | private JLabel lblNewLabel_1_1_2;
33 | private JLabel lblNewLabel_1_1_3;
34 | private JLabel lblSn;
35 | private JLabel lblTime;
36 | private JLabel lblTrain;
37 | private JLabel S1;
38 | private JLabel T1;
39 | private JLabel H1;
40 | private JLabel T2;
41 | private JLabel S2;
42 | private JLabel H2;
43 | private JLabel T3;
44 | private JLabel S3;
45 | private JLabel H3;
46 | private JLabel T4;
47 | private JLabel S4;
48 | private JLabel H4;
49 | private JLabel T5;
50 | private JLabel S5;
51 | private JLabel H5;
52 |
53 | /**
54 | * Launch the application.
55 | */
56 | public static void main(String[] args) {
57 | EventQueue.invokeLater(new Runnable() {
58 | public void run() {
59 | try {
60 | passengerTrainScreen frame = new passengerTrainScreen();
61 | frame.setVisible(true);
62 | } catch (Exception e) {
63 | e.printStackTrace();
64 | }
65 | }
66 | });
67 | }
68 |
69 | /**
70 | * Create the frame.
71 | * @throws IOException
72 | */
73 | public passengerTrainScreen() throws IOException {
74 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
75 | setBounds(100, 100, 900, 700);
76 | contentPane = new JPanel();
77 | contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
78 | contentPane.setBackground(Color.decode("#2c3e50"));
79 | setContentPane(contentPane);
80 | contentPane.setLayout(null);
81 | contentPane.add(getH5());
82 | contentPane.add(getT5());
83 | contentPane.add(getS5());
84 | contentPane.add(getS4());
85 | contentPane.add(getH4());
86 | contentPane.add(getT4());
87 | contentPane.add(getT3());
88 | contentPane.add(getH3());
89 | contentPane.add(getS3());
90 | contentPane.add(getS2());
91 | contentPane.add(getH2());
92 | contentPane.add(getT2());
93 | contentPane.add(getS1());
94 | contentPane.add(getT1());
95 | contentPane.add(getH1());
96 | contentPane.add(getLblTrain());
97 | contentPane.add(getLblTime());
98 | contentPane.add(getLblSn());
99 | contentPane.add(getLblNewLabel_1_1());
100 | contentPane.add(getLblNewLabel_3());
101 | contentPane.add(getLblNewLabel());
102 | contentPane.add(getLblNewLabel_1());
103 | contentPane.add(getLblNewLabel_1_1_1());
104 | contentPane.add(getLblNewLabel_1_1_2());
105 | contentPane.add(getLblNewLabel_1_1_3());
106 | showTrains();
107 | }
108 | private JLabel getLblNewLabel_3() {
109 | if (lblNewLabel_3 == null) {
110 | lblNewLabel_3 = new JLabel("");
111 | lblNewLabel_3.addMouseListener(new MouseAdapter() {
112 | @Override
113 | public void mouseClicked(MouseEvent e) {
114 | new passengerPortal().setVisible(true);
115 | dispose();
116 | }
117 | });
118 | lblNewLabel_3.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\back.png"));
119 | lblNewLabel_3.setBounds(815, 0, 73, 84);
120 | }
121 | return lblNewLabel_3;
122 | }
123 | private JLabel getLblNewLabel() {
124 | if (lblNewLabel == null) {
125 | lblNewLabel = new JLabel("");
126 | lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
127 | lblNewLabel.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\Asset 3ldpi.png"));
128 | lblNewLabel.setBounds(10, 99, 870, 163);
129 | }
130 | return lblNewLabel;
131 | }
132 | private JLabel getLblNewLabel_1() {
133 | if (lblNewLabel_1 == null) {
134 | lblNewLabel_1 = new JLabel("");
135 | lblNewLabel_1.setHorizontalAlignment(SwingConstants.CENTER);
136 | lblNewLabel_1.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\Asset 4ldpi.png"));
137 | lblNewLabel_1.setBounds(10, 254, 868, 84);
138 | }
139 | return lblNewLabel_1;
140 | }
141 | private JLabel getLblNewLabel_1_1() {
142 | if (lblNewLabel_1_1 == null) {
143 | lblNewLabel_1_1 = new JLabel("");
144 | lblNewLabel_1_1.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\Asset 4ldpi.png"));
145 | lblNewLabel_1_1.setHorizontalAlignment(SwingConstants.CENTER);
146 | lblNewLabel_1_1.setBounds(10, 333, 868, 84);
147 | }
148 | return lblNewLabel_1_1;
149 | }
150 | private JLabel getLblNewLabel_1_1_1() {
151 | if (lblNewLabel_1_1_1 == null) {
152 | lblNewLabel_1_1_1 = new JLabel("");
153 | lblNewLabel_1_1_1.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\Asset 4ldpi.png"));
154 | lblNewLabel_1_1_1.setHorizontalAlignment(SwingConstants.CENTER);
155 | lblNewLabel_1_1_1.setBounds(10, 412, 868, 84);
156 | }
157 | return lblNewLabel_1_1_1;
158 | }
159 | private JLabel getLblNewLabel_1_1_2() {
160 | if (lblNewLabel_1_1_2 == null) {
161 | lblNewLabel_1_1_2 = new JLabel("");
162 | lblNewLabel_1_1_2.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\Asset 4ldpi.png"));
163 | lblNewLabel_1_1_2.setHorizontalAlignment(SwingConstants.CENTER);
164 | lblNewLabel_1_1_2.setBounds(10, 491, 868, 84);
165 | }
166 | return lblNewLabel_1_1_2;
167 | }
168 | private JLabel getLblNewLabel_1_1_3() {
169 | if (lblNewLabel_1_1_3 == null) {
170 | lblNewLabel_1_1_3 = new JLabel("");
171 | lblNewLabel_1_1_3.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\Asset 4ldpi.png"));
172 | lblNewLabel_1_1_3.setHorizontalAlignment(SwingConstants.CENTER);
173 | lblNewLabel_1_1_3.setBounds(10, 570, 868, 84);
174 | }
175 | return lblNewLabel_1_1_3;
176 | }
177 | private JLabel getLblSn() {
178 | if (lblSn == null) {
179 | lblSn = new JLabel("S.N.");
180 | lblSn.setHorizontalAlignment(SwingConstants.CENTER);
181 | lblSn.setForeground(Color.WHITE);
182 | lblSn.setFont(new Font("Press Start 2P", Font.BOLD, 25));
183 | lblSn.setBounds(43, 139, 104, 84);
184 | }
185 | return lblSn;
186 | }
187 | private JLabel getLblTime() {
188 | if (lblTime == null) {
189 | lblTime = new JLabel("TIME");
190 | lblTime.setHorizontalAlignment(SwingConstants.CENTER);
191 | lblTime.setForeground(Color.WHITE);
192 | lblTime.setFont(new Font("Press Start 2P", Font.BOLD, 25));
193 | lblTime.setBounds(741, 139, 118, 84);
194 | }
195 | return lblTime;
196 | }
197 | private JLabel getLblTrain() {
198 | if (lblTrain == null) {
199 | lblTrain = new JLabel("TRAIN");
200 | lblTrain.setHorizontalAlignment(SwingConstants.CENTER);
201 | lblTrain.setForeground(Color.WHITE);
202 | lblTrain.setFont(new Font("Press Start 2P", Font.BOLD, 25));
203 | lblTrain.setBounds(157, 139, 574, 84);
204 | }
205 | return lblTrain;
206 | }
207 | private JLabel getS1() {
208 | if (S1 == null) {
209 | S1 = new JLabel("1");
210 | S1.setHorizontalAlignment(SwingConstants.CENTER);
211 | S1.setForeground(Color.WHITE);
212 | S1.setFont(new Font("Press Start 2P", Font.BOLD, 20));
213 | S1.setBounds(43, 264, 104, 58);
214 | }
215 | return S1;
216 | }
217 | private JLabel getT1() {
218 | if (T1 == null) {
219 | T1 = new JLabel("TRAIN1");
220 | T1.setHorizontalAlignment(SwingConstants.CENTER);
221 | T1.setForeground(Color.WHITE);
222 | T1.setFont(new Font("Press Start 2P", Font.BOLD, 20));
223 | T1.setBounds(157, 264, 574, 58);
224 | }
225 | return T1;
226 | }
227 | private JLabel getH1() {
228 | if (H1 == null) {
229 | H1 = new JLabel("T1");
230 | H1.setHorizontalAlignment(SwingConstants.CENTER);
231 | H1.setForeground(Color.WHITE);
232 | H1.setFont(new Font("Press Start 2P", Font.BOLD, 20));
233 | H1.setBounds(741, 264, 118, 58);
234 | }
235 | return H1;
236 | }
237 | private JLabel getT2() {
238 | if (T2 == null) {
239 | T2 = new JLabel("TRAIN2");
240 | T2.setHorizontalAlignment(SwingConstants.CENTER);
241 | T2.setForeground(Color.WHITE);
242 | T2.setFont(new Font("Press Start 2P", Font.BOLD, 20));
243 | T2.setBounds(157, 343, 574, 58);
244 | }
245 | return T2;
246 | }
247 | private JLabel getS2() {
248 | if (S2 == null) {
249 | S2 = new JLabel("2");
250 | S2.setHorizontalAlignment(SwingConstants.CENTER);
251 | S2.setForeground(Color.WHITE);
252 | S2.setFont(new Font("Press Start 2P", Font.BOLD, 20));
253 | S2.setBounds(43, 343, 104, 58);
254 | }
255 | return S2;
256 | }
257 | private JLabel getH2() {
258 | if (H2 == null) {
259 | H2 = new JLabel("T2");
260 | H2.setHorizontalAlignment(SwingConstants.CENTER);
261 | H2.setForeground(Color.WHITE);
262 | H2.setFont(new Font("Press Start 2P", Font.BOLD, 20));
263 | H2.setBounds(741, 343, 118, 58);
264 | }
265 | return H2;
266 | }
267 | private JLabel getT3() {
268 | if (T3 == null) {
269 | T3 = new JLabel("TRAIN3");
270 | T3.setHorizontalAlignment(SwingConstants.CENTER);
271 | T3.setForeground(Color.WHITE);
272 | T3.setFont(new Font("Press Start 2P", Font.BOLD, 20));
273 | T3.setBounds(157, 428, 574, 58);
274 | }
275 | return T3;
276 | }
277 | private JLabel getS3() {
278 | if (S3 == null) {
279 | S3 = new JLabel("3");
280 | S3.setHorizontalAlignment(SwingConstants.CENTER);
281 | S3.setForeground(Color.WHITE);
282 | S3.setFont(new Font("Press Start 2P", Font.BOLD, 20));
283 | S3.setBounds(43, 428, 104, 58);
284 | }
285 | return S3;
286 | }
287 | private JLabel getH3() {
288 | if (H3 == null) {
289 | H3 = new JLabel("T3");
290 | H3.setHorizontalAlignment(SwingConstants.CENTER);
291 | H3.setForeground(Color.WHITE);
292 | H3.setFont(new Font("Press Start 2P", Font.BOLD, 20));
293 | H3.setBounds(741, 428, 118, 58);
294 | }
295 | return H3;
296 | }
297 | private JLabel getT4() {
298 | if (T4 == null) {
299 | T4 = new JLabel("TRAIN4");
300 | T4.setHorizontalAlignment(SwingConstants.CENTER);
301 | T4.setForeground(Color.WHITE);
302 | T4.setFont(new Font("Press Start 2P", Font.BOLD, 20));
303 | T4.setBounds(157, 507, 574, 58);
304 | }
305 | return T4;
306 | }
307 | private JLabel getS4() {
308 | if (S4 == null) {
309 | S4 = new JLabel("4");
310 | S4.setHorizontalAlignment(SwingConstants.CENTER);
311 | S4.setForeground(Color.WHITE);
312 | S4.setFont(new Font("Press Start 2P", Font.BOLD, 20));
313 | S4.setBounds(43, 507, 104, 58);
314 | }
315 | return S4;
316 | }
317 | private JLabel getH4() {
318 | if (H4 == null) {
319 | H4 = new JLabel("T4");
320 | H4.setHorizontalAlignment(SwingConstants.CENTER);
321 | H4.setForeground(Color.WHITE);
322 | H4.setFont(new Font("Press Start 2P", Font.BOLD, 20));
323 | H4.setBounds(741, 507, 118, 58);
324 | }
325 | return H4;
326 | }
327 | private JLabel getT5() {
328 | if (T5 == null) {
329 | T5 = new JLabel("TRAIN5");
330 | T5.setHorizontalAlignment(SwingConstants.CENTER);
331 | T5.setForeground(Color.WHITE);
332 | T5.setFont(new Font("Press Start 2P", Font.BOLD, 20));
333 | T5.setBounds(157, 586, 574, 58);
334 | }
335 | return T5;
336 | }
337 | private JLabel getS5() {
338 | if (S5 == null) {
339 | S5 = new JLabel("5");
340 | S5.setHorizontalAlignment(SwingConstants.CENTER);
341 | S5.setForeground(Color.WHITE);
342 | S5.setFont(new Font("Press Start 2P", Font.BOLD, 20));
343 | S5.setBounds(43, 586, 104, 58);
344 | }
345 | return S5;
346 | }
347 | private JLabel getH5() {
348 | if (H5 == null) {
349 | H5 = new JLabel("T5");
350 | H5.setHorizontalAlignment(SwingConstants.CENTER);
351 | H5.setForeground(Color.WHITE);
352 | H5.setFont(new Font("Press Start 2P", Font.BOLD, 20));
353 | H5.setBounds(741, 586, 118, 58);
354 | }
355 | return H5;
356 | }
357 |
358 | private void showTrains() throws IOException {
359 | ArrayList trains = arrays.getTrainScreen();
360 |
361 | int length = trains.size();
362 | if(length<=1) {
363 | S1.setText("1");
364 | S2.setText("");
365 | S3.setText("");
366 | S4.setText("");
367 | S5.setText("");
368 | T1.setText(trains.get(0)[0]);
369 | H1.setText(trains.get(0)[1]);
370 | T2.setText("");
371 | H2.setText("");
372 | T3.setText("");
373 | H3.setText("");
374 | T4.setText("");
375 | H4.setText("");
376 | T5.setText("");
377 | H5.setText("");
378 | }
379 |
380 | else if(length<=2) {
381 | S1.setText("1");
382 | S2.setText("2");
383 | S3.setText("");
384 | S4.setText("");
385 | S5.setText("");
386 | T1.setText(trains.get(0)[0]);
387 | H1.setText(trains.get(0)[1]);
388 | T2.setText(trains.get(1)[0]);
389 | H2.setText(trains.get(1)[1]);
390 | T3.setText("");
391 | H3.setText("");
392 | T4.setText("");
393 | H4.setText("");
394 | T5.setText("");
395 | H5.setText("");
396 | }
397 | else if(length<=3) {
398 | S1.setText("1");
399 | S2.setText("2");
400 | S3.setText("3");
401 | S4.setText("");
402 | S5.setText("");
403 | T1.setText(trains.get(0)[0]);
404 | H1.setText(trains.get(0)[1]);
405 | T2.setText(trains.get(1)[0]);
406 | H2.setText(trains.get(1)[1]);
407 | T3.setText(trains.get(2)[0]);
408 | H3.setText(trains.get(2)[1]);
409 | T4.setText("");
410 | H4.setText("");
411 | T5.setText("");
412 | H5.setText("");
413 | }
414 | else if(length<=4) {
415 | S1.setText("1");
416 | S2.setText("2");
417 | S3.setText("3");
418 | S4.setText("4");
419 | S5.setText("");
420 | T1.setText(trains.get(0)[0]);
421 | H1.setText(trains.get(0)[1]);
422 | T2.setText(trains.get(1)[0]);
423 | H2.setText(trains.get(1)[1]);
424 | T3.setText(trains.get(2)[0]);
425 | H3.setText(trains.get(2)[1]);
426 | T4.setText(trains.get(3)[0]);
427 | H4.setText(trains.get(3)[1]);
428 | T5.setText("");
429 | H5.setText("");
430 | }
431 | else {
432 | S1.setText("1");
433 | S2.setText("2");
434 | S3.setText("3");
435 | S4.setText("4");
436 | S5.setText("5");
437 | T1.setText(trains.get(0)[0]);
438 | H1.setText(trains.get(0)[1]);
439 | T2.setText(trains.get(1)[0]);
440 | H2.setText(trains.get(1)[1]);
441 | T3.setText(trains.get(2)[0]);
442 | H3.setText(trains.get(2)[1]);
443 | T4.setText(trains.get(3)[0]);
444 | H4.setText(trains.get(3)[1]);
445 | T5.setText(trains.get(4)[0]);
446 | H5.setText(trains.get(4)[1]);
447 | }
448 |
449 | }
450 | }
451 |
--------------------------------------------------------------------------------
/src/view/ticketBooking.java:
--------------------------------------------------------------------------------
1 | package view;
2 |
3 | import java.awt.BorderLayout;
4 | import java.awt.Color;
5 | import java.awt.EventQueue;
6 |
7 | import javax.swing.JFrame;
8 | import javax.swing.JPanel;
9 | import javax.swing.border.EmptyBorder;
10 | import javax.swing.JLabel;
11 | import javax.swing.JOptionPane;
12 | import javax.swing.ImageIcon;
13 | import java.awt.Font;
14 | import javax.swing.SwingConstants;
15 | import java.awt.event.MouseAdapter;
16 | import java.awt.event.MouseEvent;
17 | import java.io.IOException;
18 | import java.text.DateFormat;
19 | import java.text.SimpleDateFormat;
20 | import java.util.ArrayList;
21 | import java.util.Arrays;
22 | import java.util.Date;
23 |
24 | import javax.swing.JTextField;
25 | import javax.swing.JComboBox;
26 | import com.toedter.calendar.JDateChooser;
27 |
28 | import data_structures.arrays;
29 |
30 | import javax.swing.DefaultComboBoxModel;
31 | import javax.swing.JSpinner;
32 | import javax.swing.SpinnerNumberModel;
33 | import java.awt.event.ActionListener;
34 | import java.awt.event.ActionEvent;
35 | import javax.swing.event.ChangeListener;
36 | import javax.swing.event.ChangeEvent;
37 |
38 | public class ticketBooking extends JFrame {
39 |
40 | private JPanel contentPane;
41 | private JLabel lblNewLabel_3;
42 | private JLabel lblNewLabel;
43 | private JLabel lblNewLabel_1;
44 | private JLabel lblNewLabel_1_1;
45 | private JLabel lblNewLabel_5;
46 | private JLabel lblNewLabel_1_1_1;
47 | private JLabel lblNewLabel_5_1;
48 | private JLabel lblName;
49 | private JLabel lblTo;
50 | private JLabel lblDate;
51 | private JLabel lblName_2_1;
52 | private JLabel lblName_2_1_1;
53 | private JLabel lblName_2_1_2;
54 | private JLabel lblName_2_1_2_1;
55 | private JTextField name_txt;
56 | private JTextField price_txt;
57 | private JComboBox train_combo;
58 | private JDateChooser date_chooser;
59 | private JComboBox from_combo;
60 | private JComboBox to_combo;
61 | private JSpinner tickets_spinner;
62 | private arrays a = new arrays();
63 |
64 | /**
65 | * Launch the application.
66 | */
67 | public static void main(String[] args) {
68 | EventQueue.invokeLater(new Runnable() {
69 | public void run() {
70 | try {
71 | ticketBooking frame = new ticketBooking();
72 | frame.setVisible(true);
73 | } catch (Exception e) {
74 | e.printStackTrace();
75 | }
76 | }
77 | });
78 | }
79 |
80 | /**
81 | * Create the frame.
82 | * @throws IOException
83 | */
84 | public ticketBooking() throws IOException {
85 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
86 | setBounds(100, 100, 900, 700);
87 | contentPane = new JPanel();
88 | contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
89 | contentPane.setBackground(Color.decode("#2c3e50"));
90 | setContentPane(contentPane);
91 | contentPane.setLayout(null);
92 | contentPane.add(getTickets_spinner());
93 | contentPane.add(getTo_combo());
94 | contentPane.add(getFrom_combo());
95 | contentPane.add(getDate_chooser());
96 | contentPane.add(getTrain_combo());
97 | contentPane.add(getPrice_txt());
98 | contentPane.add(getName_txt());
99 | contentPane.add(getLblName_2_1_2_1());
100 | contentPane.add(getLblName_2_1_2());
101 | contentPane.add(getLblName_2_1_1());
102 | contentPane.add(getLblName_2_1());
103 | contentPane.add(getLblDate());
104 | contentPane.add(getLblTo());
105 | contentPane.add(getLblName());
106 | contentPane.add(getLblNewLabel_5_1());
107 | contentPane.add(getLblNewLabel_1_1_1());
108 | contentPane.add(getLblNewLabel_5());
109 | contentPane.add(getLblNewLabel_1_1());
110 | contentPane.add(getLblNewLabel_1());
111 | contentPane.add(getLblNewLabel_3());
112 | contentPane.add(getLblNewLabel());
113 | giveTrainNames();
114 | }
115 | private JLabel getLblNewLabel_3() {
116 | if (lblNewLabel_3 == null) {
117 | lblNewLabel_3 = new JLabel("");
118 | lblNewLabel_3.addMouseListener(new MouseAdapter() {
119 | @Override
120 | public void mouseClicked(MouseEvent e) {
121 | new passengerPortal().setVisible(true);
122 | dispose();
123 | }
124 | });
125 | lblNewLabel_3.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\back.png"));
126 | lblNewLabel_3.setBounds(815, 11, 73, 84);
127 | }
128 | return lblNewLabel_3;
129 | }
130 | private JLabel getLblNewLabel() {
131 | if (lblNewLabel == null) {
132 | lblNewLabel = new JLabel("");
133 | lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
134 | lblNewLabel.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\ticketBooking1.png"));
135 | lblNewLabel.setBounds(10, 85, 868, 580);
136 | }
137 | return lblNewLabel;
138 | }
139 | private JLabel getLblNewLabel_1() {
140 | if (lblNewLabel_1 == null) {
141 | lblNewLabel_1 = new JLabel("");
142 | lblNewLabel_1.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\index3.png"));
143 | lblNewLabel_1.setBounds(21, 11, 232, 75);
144 | }
145 | return lblNewLabel_1;
146 | }
147 | private JLabel getLblNewLabel_1_1() {
148 | if (lblNewLabel_1_1 == null) {
149 | lblNewLabel_1_1 = new JLabel("");
150 | lblNewLabel_1_1.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\index3.png"));
151 | lblNewLabel_1_1.setBounds(91, 11, 232, 75);
152 | }
153 | return lblNewLabel_1_1;
154 | }
155 | private JLabel getLblNewLabel_5() {
156 | if (lblNewLabel_5 == null) {
157 | lblNewLabel_5 = new JLabel("BOOK A TICKET");
158 | lblNewLabel_5.setHorizontalAlignment(SwingConstants.CENTER);
159 | lblNewLabel_5.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
160 | lblNewLabel_5.setBounds(31, 12, 280, 74);
161 | }
162 | return lblNewLabel_5;
163 | }
164 | private JLabel getLblNewLabel_1_1_1() {
165 | if (lblNewLabel_1_1_1 == null) {
166 | lblNewLabel_1_1_1 = new JLabel("");
167 | lblNewLabel_1_1_1.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\index3.png"));
168 | lblNewLabel_1_1_1.setBounds(598, 526, 232, 75);
169 | }
170 | return lblNewLabel_1_1_1;
171 | }
172 | private JLabel getLblNewLabel_5_1() {
173 | if (lblNewLabel_5_1 == null) {
174 | lblNewLabel_5_1 = new JLabel("BOOK");
175 | lblNewLabel_5_1.addMouseListener(new MouseAdapter() {
176 | @Override
177 | public void mouseClicked(MouseEvent e) {
178 |
179 | //validate
180 | if(from_combo.getSelectedIndex()==0) {
181 | JOptionPane.showMessageDialog(from_combo, "SELECT FROM");
182 | return;
183 | }
184 | if(to_combo.getSelectedIndex()==0) {
185 | JOptionPane.showMessageDialog(from_combo, "SELECT TO");
186 | return;
187 | }
188 | if(from_combo.getSelectedIndex()==to_combo.getSelectedIndex()) {
189 | JOptionPane.showMessageDialog(from_combo, "INVALID FROM AND TO ARE SAME");
190 | return;
191 | }
192 | if(name_txt.getText().isEmpty()) {
193 | JOptionPane.showMessageDialog(name_txt, "ENTER YOUR NAME");
194 | return;
195 | }
196 | if((int)tickets_spinner.getValue()==0) {
197 | JOptionPane.showMessageDialog(tickets_spinner, "CHOOSE ATLEASE ONE TICKET");
198 | return;
199 | }
200 | if(train_combo.getSelectedIndex()==0) {
201 | JOptionPane.showMessageDialog(train_combo, "SELECT TRAIN");
202 | return;
203 | }
204 |
205 | //to pass this object to ticketView
206 | String from = (String) from_combo.getSelectedItem();
207 | String to = (String) to_combo.getSelectedItem();
208 | Date d = date_chooser.getDate();
209 | DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd");
210 | String date = dateFormat.format(d);
211 | String name = name_txt.getText();
212 | int noOfTickets = (Integer)tickets_spinner.getValue();
213 | String trainName = (String) train_combo.getSelectedItem();
214 | String price = price_txt.getText();
215 |
216 | //set the ticket to show it in view
217 | String ticket[] = {from, to, date, name, String.valueOf(noOfTickets), trainName, price};
218 | try {
219 | a.setTicket(ticket);
220 | new ticketView().setVisible(true);
221 | dispose();
222 | } catch (IOException e1) {
223 | // TODO Auto-generated catch block
224 | e1.printStackTrace();
225 | }
226 |
227 | }
228 | });
229 | lblNewLabel_5_1.setHorizontalAlignment(SwingConstants.CENTER);
230 | lblNewLabel_5_1.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
231 | lblNewLabel_5_1.setBounds(598, 527, 232, 74);
232 | }
233 | return lblNewLabel_5_1;
234 | }
235 | private JLabel getLblName() {
236 | if (lblName == null) {
237 | lblName = new JLabel("FROM");
238 | lblName.setHorizontalAlignment(SwingConstants.CENTER);
239 | lblName.setForeground(Color.BLACK);
240 | lblName.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
241 | lblName.setBounds(21, 109, 282, 46);
242 | }
243 | return lblName;
244 | }
245 | private JLabel getLblTo() {
246 | if (lblTo == null) {
247 | lblTo = new JLabel("TO");
248 | lblTo.setHorizontalAlignment(SwingConstants.CENTER);
249 | lblTo.setForeground(Color.BLACK);
250 | lblTo.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
251 | lblTo.setBounds(21, 166, 282, 46);
252 | }
253 | return lblTo;
254 | }
255 | private JLabel getLblDate() {
256 | if (lblDate == null) {
257 | lblDate = new JLabel("DATE");
258 | lblDate.setHorizontalAlignment(SwingConstants.CENTER);
259 | lblDate.setForeground(Color.BLACK);
260 | lblDate.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
261 | lblDate.setBounds(21, 223, 282, 46);
262 | }
263 | return lblDate;
264 | }
265 | private JLabel getLblName_2_1() {
266 | if (lblName_2_1 == null) {
267 | lblName_2_1 = new JLabel("NAME");
268 | lblName_2_1.setHorizontalAlignment(SwingConstants.CENTER);
269 | lblName_2_1.setForeground(Color.BLACK);
270 | lblName_2_1.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
271 | lblName_2_1.setBounds(21, 280, 282, 46);
272 | }
273 | return lblName_2_1;
274 | }
275 | private JLabel getLblName_2_1_1() {
276 | if (lblName_2_1_1 == null) {
277 | lblName_2_1_1 = new JLabel("NO OF TICKETS");
278 | lblName_2_1_1.setHorizontalAlignment(SwingConstants.CENTER);
279 | lblName_2_1_1.setForeground(Color.BLACK);
280 | lblName_2_1_1.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
281 | lblName_2_1_1.setBounds(21, 337, 282, 46);
282 | }
283 | return lblName_2_1_1;
284 | }
285 | private JLabel getLblName_2_1_2() {
286 | if (lblName_2_1_2 == null) {
287 | lblName_2_1_2 = new JLabel("TRAIN NAME");
288 | lblName_2_1_2.setHorizontalAlignment(SwingConstants.CENTER);
289 | lblName_2_1_2.setForeground(Color.BLACK);
290 | lblName_2_1_2.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
291 | lblName_2_1_2.setBounds(21, 388, 282, 46);
292 | }
293 | return lblName_2_1_2;
294 | }
295 | private JLabel getLblName_2_1_2_1() {
296 | if (lblName_2_1_2_1 == null) {
297 | lblName_2_1_2_1 = new JLabel("PRICE");
298 | lblName_2_1_2_1.setHorizontalAlignment(SwingConstants.CENTER);
299 | lblName_2_1_2_1.setForeground(Color.BLACK);
300 | lblName_2_1_2_1.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
301 | lblName_2_1_2_1.setBounds(21, 445, 282, 46);
302 | }
303 | return lblName_2_1_2_1;
304 | }
305 | private JTextField getName_txt() {
306 | if (name_txt == null) {
307 | name_txt = new JTextField();
308 | name_txt.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
309 | name_txt.setColumns(10);
310 | name_txt.setBounds(313, 284, 517, 42);
311 | }
312 | return name_txt;
313 | }
314 | private JTextField getPrice_txt() {
315 | if (price_txt == null) {
316 | price_txt = new JTextField();
317 | price_txt.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
318 | price_txt.setEditable(false);
319 | price_txt.setColumns(10);
320 | price_txt.setBounds(313, 445, 517, 42);
321 | }
322 | return price_txt;
323 | }
324 | private JComboBox getTrain_combo() {
325 | if (train_combo == null) {
326 | train_combo = new JComboBox();
327 | train_combo.addActionListener(new ActionListener() {
328 | public void actionPerformed(ActionEvent e) {
329 | try {
330 | //get the train prices for calculating total
331 | ArrayList prices = giveTrainPrices();
332 | int index = train_combo.getSelectedIndex();
333 | int noOfTickets = (int)tickets_spinner.getValue();
334 | if(index==0) {
335 | price_txt.setText("0");
336 | }
337 | int price = Integer.parseInt(prices.get(index-1));
338 | int total = price*noOfTickets;
339 | //change everytime the input changes
340 | price_txt.setText(String.valueOf(total));
341 | } catch (IOException e1) {
342 | // TODO Auto-generated catch block
343 | e1.printStackTrace();
344 | }
345 | }
346 | });
347 | train_combo.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
348 | train_combo.setBounds(313, 388, 517, 42);
349 | }
350 | return train_combo;
351 | }
352 | private JDateChooser getDate_chooser() {
353 | if (date_chooser == null) {
354 | date_chooser = new JDateChooser();
355 | date_chooser.setBounds(313, 221, 517, 52);
356 | }
357 | return date_chooser;
358 | }
359 | private JComboBox getFrom_combo() {
360 | if (from_combo == null) {
361 | from_combo = new JComboBox();
362 | from_combo.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
363 | from_combo.setModel(new DefaultComboBoxModel(new String[] {"...", "Karunagapally", "Kochi", "Calicut", "Goa", "Delhi", "Mumbai"}));
364 | from_combo.setBounds(313, 113, 517, 42);
365 | }
366 | return from_combo;
367 | }
368 | private JComboBox getTo_combo() {
369 | if (to_combo == null) {
370 | to_combo = new JComboBox();
371 | to_combo.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
372 | to_combo.setModel(new DefaultComboBoxModel(new String[] {"...", "Karunagapally", "Kochi", "Calicut", "Goa", "Delhi", "Mumbai"}));
373 | to_combo.setBounds(313, 168, 517, 42);
374 | }
375 | return to_combo;
376 | }
377 | private JSpinner getTickets_spinner() {
378 | if (tickets_spinner == null) {
379 | tickets_spinner = new JSpinner();
380 | tickets_spinner.addChangeListener(new ChangeListener() {
381 | public void stateChanged(ChangeEvent e) {
382 | try {
383 | ArrayList prices = giveTrainPrices();
384 | int index = train_combo.getSelectedIndex();
385 | int noOfTickets = (int)tickets_spinner.getValue();
386 | if(index==0) {
387 | price_txt.setText("0");
388 | return;
389 | }
390 | int price = Integer.parseInt(prices.get(index-1));
391 | int total = price*noOfTickets;
392 | price_txt.setText(String.valueOf(total));
393 | } catch (IOException e1) {
394 | // TODO Auto-generated catch block
395 | e1.printStackTrace();
396 | }
397 | }
398 | });
399 | tickets_spinner.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
400 | tickets_spinner.setModel(new SpinnerNumberModel(0, 0, 10, 1));
401 | tickets_spinner.setBounds(313, 337, 517, 42);
402 | }
403 | return tickets_spinner;
404 | }
405 |
406 | //method to automatically display the train names from the
407 | private void giveTrainNames() throws IOException {
408 | ArrayList trains = arrays.getTrains();
409 | ArrayList trainNames = new ArrayList();
410 | for (String[] x : trains) {
411 | trainNames.add(x[1]);
412 | }
413 | train_combo.setModel(new DefaultComboBoxModel(new String[] {"...", trainNames.get(0), trainNames.get(1), trainNames.get(2), trainNames.get(3), trainNames.get(4), trainNames.get(5), trainNames.get(6) }));
414 | }
415 |
416 | //method to pass the arraylist of prices
417 | private ArrayList giveTrainPrices() throws IOException {
418 | ArrayList trains = arrays.getTrains();
419 | ArrayList trainPrices = new ArrayList();
420 | for (String[] x : trains) {
421 | System.out.println(Arrays.toString(x));
422 | trainPrices.add(x[2]);
423 | }
424 | return trainPrices;
425 | }
426 |
427 |
428 | }
429 |
--------------------------------------------------------------------------------
/src/view/officialPortal.java:
--------------------------------------------------------------------------------
1 | package view;
2 |
3 | import java.awt.BorderLayout;
4 | import java.awt.Color;
5 | import java.awt.EventQueue;
6 |
7 | import javax.swing.JFrame;
8 | import javax.swing.JPanel;
9 | import javax.swing.border.EmptyBorder;
10 | import javax.swing.JLabel;
11 | import javax.swing.JOptionPane;
12 | import javax.swing.ImageIcon;
13 | import java.awt.Font;
14 | import javax.swing.SwingConstants;
15 | import java.awt.event.MouseAdapter;
16 | import java.awt.event.MouseEvent;
17 | import java.io.IOException;
18 | import java.util.ArrayList;
19 | import java.awt.FlowLayout;
20 | import javax.swing.BoxLayout;
21 | import javax.swing.DefaultComboBoxModel;
22 | import javax.swing.JTable;
23 | import javax.swing.table.DefaultTableModel;
24 |
25 | import data_structures.arrays;
26 | import data_structures.fileHandler;
27 | import data_structures.linkedList;
28 | import data_structures.queue;
29 |
30 | import javax.swing.JTextField;
31 | import javax.swing.JSeparator;
32 | import javax.swing.JComboBox;
33 |
34 | public class officialPortal extends JFrame {
35 |
36 | private JPanel contentPane;
37 | private JLabel lblNewLabel_3;
38 | private JLabel lblAddTrain;
39 | private JTextField time_txt;
40 | private JLabel lblName;
41 | private JLabel lblTime;
42 | private JSeparator separator;
43 | private JLabel lblNewLabel;
44 | private JLabel lblNewLabel_1;
45 | private JSeparator separator_1;
46 | private JLabel lblNewLabel_1_1;
47 | private JLabel lblNewLabel_1_1_1;
48 | private JLabel lblLateQueue;
49 | private JSeparator separator_2;
50 | private JLabel lblTrainScreen;
51 | private JLabel lblTime_1;
52 | private JLabel lblTime_1_1;
53 | private JLabel lblTime_1_1_1;
54 | private JSeparator separator_3;
55 | private JLabel lblNewLabel_2;
56 | private JLabel lblOfficialPortal;
57 | private JLabel lblNewLabel_4;
58 | private JLabel lblNewLabel_5;
59 | private JLabel lblNewLabel_5_1;
60 | private JLabel lblNewLabel_5_1_1;
61 | private JLabel lblNewLabel_5_1_2;
62 | private JLabel lblNewLabel_5_1_3;
63 | private JLabel S1;
64 | private JLabel S2;
65 | private JLabel S3;
66 | private JLabel S4;
67 | private JLabel S5;
68 | private JLabel T1;
69 | private JLabel H1;
70 | private JLabel T2;
71 | private JLabel T3;
72 | private JLabel T4;
73 | private JLabel T5;
74 | private JLabel H2;
75 | private JLabel H3;
76 | private JLabel H4;
77 | private JLabel H5;
78 | private JLabel lblNewLabel_5_2;
79 | private JLabel lblNewLabel_5_3;
80 | private JLabel lblNewLabel_5_4;
81 | private JLabel lblTime_1_2_5;
82 | private JLabel LT1;
83 | private JLabel lblTime_1_2_6;
84 | private JLabel LT2;
85 | private JLabel lblTime_1_2_7;
86 | private JLabel LT3;
87 | private JComboBox train_combo;
88 | private JTextField remove_txt;
89 | private JTextField addBack_txt;
90 | private JLabel lblTime_1_2;
91 | private JLabel lblNewLabel_1_2;
92 |
93 | /**
94 | * Launch the application.
95 | */
96 | public static void main(String[] args) {
97 | EventQueue.invokeLater(new Runnable() {
98 | public void run() {
99 | try {
100 | officialPortal frame = new officialPortal();
101 | frame.setVisible(true);
102 | } catch (Exception e) {
103 | e.printStackTrace();
104 | }
105 | }
106 | });
107 | }
108 |
109 | /**
110 | * Create the frame.
111 | * @throws IOException
112 | */
113 | public officialPortal() throws IOException {
114 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
115 | setBounds(100, 100, 1500, 750);
116 | contentPane = new JPanel();
117 | contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
118 | contentPane.setBackground(Color.decode("#2c3e50"));
119 | setContentPane(contentPane);
120 | contentPane.setLayout(null);
121 | contentPane.add(getLblTime_1_2());
122 | contentPane.add(getLblNewLabel_1_2());
123 | contentPane.add(getAddBack_txt());
124 | contentPane.add(getRemove_txt());
125 | contentPane.add(getTrain_combo());
126 | contentPane.add(getLT3());
127 | contentPane.add(getLblTime_1_2_7());
128 | contentPane.add(getLT2());
129 | contentPane.add(getLblTime_1_2_6());
130 | contentPane.add(getLblTime_1_2_5());
131 | contentPane.add(getLT1());
132 | contentPane.add(getLblNewLabel_5_3_1());
133 | contentPane.add(getLblNewLabel_5_4_1());
134 | contentPane.add(getLblNewLabel_5_2_1());
135 | contentPane.add(getH3());
136 | contentPane.add(getT3());
137 | contentPane.add(getH2());
138 | contentPane.add(getH5());
139 | contentPane.add(getH4());
140 | contentPane.add(getT2());
141 | contentPane.add(getT5());
142 | contentPane.add(getT4());
143 | contentPane.add(getT1());
144 | contentPane.add(getH1());
145 | contentPane.add(getS5());
146 | contentPane.add(getS3());
147 | contentPane.add(getS2());
148 | contentPane.add(getS4());
149 | contentPane.add(getS1());
150 | contentPane.add(getLblNewLabel_5_1_3());
151 | contentPane.add(getLblNewLabel_5_1_1_1());
152 | contentPane.add(getLblNewLabel_5_1_2());
153 | contentPane.add(getLblNewLabel_5_1_1());
154 | contentPane.add(getLblNewLabel_5());
155 | contentPane.add(getLblOfficialPortal());
156 | contentPane.add(getSeparator_3());
157 | contentPane.add(getLblTime_1_1_1());
158 | contentPane.add(getLblTime_1_1());
159 | contentPane.add(getLblTime_1());
160 | contentPane.add(getLblLateQueue());
161 | contentPane.add(getLblNewLabel_1_1_1());
162 | contentPane.add(getLblNewLabel_1_1());
163 | contentPane.add(getSeparator_1());
164 | contentPane.add(getLblNewLabel_1());
165 | contentPane.add(getLblNewLabel_3());
166 | contentPane.add(getLblAddTrain());
167 | contentPane.add(getTime_txt());
168 | contentPane.add(getLblName());
169 | contentPane.add(getLblTime());
170 | contentPane.add(getSeparator());
171 | contentPane.add(getLblNewLabel());
172 | contentPane.add(getSeparator_2());
173 | contentPane.add(getLblTrainScreen());
174 | contentPane.add(getLblNewLabel_2());
175 | contentPane.add(getLblNewLabel_4());
176 | setTrainScreen();
177 | giveTrainNames();
178 | setQueue();
179 | }
180 | private JLabel getLblNewLabel_3() {
181 | if (lblNewLabel_3 == null) {
182 | lblNewLabel_3 = new JLabel("");
183 | lblNewLabel_3.addMouseListener(new MouseAdapter() {
184 | @Override
185 | public void mouseClicked(MouseEvent e) {
186 | new passengerLoginFrame().setVisible(true);
187 | dispose();
188 | }
189 | });
190 | lblNewLabel_3.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\back.png"));
191 | lblNewLabel_3.setBounds(1403, 10, 73, 84);
192 | }
193 | return lblNewLabel_3;
194 | }
195 | private JLabel getLblAddTrain() {
196 | if (lblAddTrain == null) {
197 | lblAddTrain = new JLabel("ADD TRAIN");
198 | lblAddTrain.setHorizontalAlignment(SwingConstants.CENTER);
199 | lblAddTrain.setForeground(Color.BLACK);
200 | lblAddTrain.setFont(new Font("Press Start 2P", Font.BOLD, 20));
201 | lblAddTrain.setBounds(46, 139, 196, 45);
202 | }
203 | return lblAddTrain;
204 | }
205 | private JTextField getTime_txt() {
206 | if (time_txt == null) {
207 | time_txt = new JTextField();
208 | time_txt.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
209 | time_txt.setColumns(10);
210 | time_txt.setBounds(501, 264, 136, 45);
211 | }
212 | return time_txt;
213 | }
214 | private JLabel getLblName() {
215 | if (lblName == null) {
216 | lblName = new JLabel("NAME");
217 | lblName.setHorizontalAlignment(SwingConstants.CENTER);
218 | lblName.setForeground(Color.BLACK);
219 | lblName.setFont(new Font("Press Start 2P", Font.BOLD, 20));
220 | lblName.setBounds(31, 203, 211, 45);
221 | }
222 | return lblName;
223 | }
224 | private JLabel getLblTime() {
225 | if (lblTime == null) {
226 | lblTime = new JLabel("TIME");
227 | lblTime.setHorizontalAlignment(SwingConstants.CENTER);
228 | lblTime.setForeground(Color.BLACK);
229 | lblTime.setFont(new Font("Press Start 2P", Font.BOLD, 20));
230 | lblTime.setBounds(501, 208, 136, 45);
231 | }
232 | return lblTime;
233 | }
234 | private JSeparator getSeparator() {
235 | if (separator == null) {
236 | separator = new JSeparator();
237 | separator.setBounds(31, 191, 233, 8);
238 | }
239 | return separator;
240 | }
241 | private JLabel getLblNewLabel() {
242 | if (lblNewLabel == null) {
243 | lblNewLabel = new JLabel("");
244 | lblNewLabel.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\ticketBooking1.png"));
245 | lblNewLabel.setBounds(20, 99, 858, 605);
246 | }
247 | return lblNewLabel;
248 | }
249 | private JLabel getLblNewLabel_1() {
250 | if (lblNewLabel_1 == null) {
251 | lblNewLabel_1 = new JLabel("");
252 | lblNewLabel_1.setHorizontalAlignment(SwingConstants.CENTER);
253 | lblNewLabel_1.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\Asset 1ldpi.png"));
254 | lblNewLabel_1.setBounds(658, 225, 211, 84);
255 | }
256 | return lblNewLabel_1;
257 | }
258 | private JSeparator getSeparator_1() {
259 | if (separator_1 == null) {
260 | separator_1 = new JSeparator();
261 | separator_1.setBounds(31, 320, 830, 8);
262 | }
263 | return separator_1;
264 | }
265 | private JLabel getLblNewLabel_1_1() {
266 | if (lblNewLabel_1_1 == null) {
267 | lblNewLabel_1_1 = new JLabel("");
268 | lblNewLabel_1_1.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\Asset 1ldpi.png"));
269 | lblNewLabel_1_1.setHorizontalAlignment(SwingConstants.CENTER);
270 | lblNewLabel_1_1.setBounds(41, 405, 211, 84);
271 | }
272 | return lblNewLabel_1_1;
273 | }
274 | private JLabel getLblNewLabel_1_1_1() {
275 | if (lblNewLabel_1_1_1 == null) {
276 | lblNewLabel_1_1_1 = new JLabel("");
277 | lblNewLabel_1_1_1.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\Asset 1ldpi.png"));
278 | lblNewLabel_1_1_1.setHorizontalAlignment(SwingConstants.CENTER);
279 | lblNewLabel_1_1_1.setBounds(41, 568, 211, 84);
280 | }
281 | return lblNewLabel_1_1_1;
282 | }
283 | private JLabel getLblLateQueue() {
284 | if (lblLateQueue == null) {
285 | lblLateQueue = new JLabel("LATE QUEUE");
286 | lblLateQueue.setHorizontalAlignment(SwingConstants.CENTER);
287 | lblLateQueue.setForeground(Color.BLACK);
288 | lblLateQueue.setFont(new Font("Press Start 2P", Font.BOLD, 20));
289 | lblLateQueue.setBounds(285, 339, 554, 45);
290 | }
291 | return lblLateQueue;
292 | }
293 | private JSeparator getSeparator_2() {
294 | if (separator_2 == null) {
295 | separator_2 = new JSeparator();
296 | separator_2.setBounds(1039, 164, 288, 8);
297 | }
298 | return separator_2;
299 | }
300 | private JLabel getLblTrainScreen() {
301 | if (lblTrainScreen == null) {
302 | lblTrainScreen = new JLabel("TRAIN SCREEN");
303 | lblTrainScreen.setHorizontalAlignment(SwingConstants.CENTER);
304 | lblTrainScreen.setForeground(Color.WHITE);
305 | lblTrainScreen.setFont(new Font("Press Start 2P", Font.BOLD, 20));
306 | lblTrainScreen.setBounds(904, 126, 556, 45);
307 | }
308 | return lblTrainScreen;
309 | }
310 | private JLabel getLblTime_1() {
311 | if (lblTime_1 == null) {
312 | lblTime_1 = new JLabel("ADD");
313 | lblTime_1.addMouseListener(new MouseAdapter() {
314 | @Override
315 | public void mouseClicked(MouseEvent e) {
316 |
317 | //validation
318 | if(train_combo.getSelectedIndex()==0) {
319 | JOptionPane.showMessageDialog(train_combo, "SELECT TRAIN");
320 | return;
321 | }
322 | if(time_txt.getText().isEmpty()) {
323 | JOptionPane.showMessageDialog(time_txt, "ENTER TIME");
324 | return;
325 | }
326 | if(!time_txt.getText().matches("^(2[0-3]|[01]?[0-9]):([0-5]?[0-9])$")) {
327 | JOptionPane.showMessageDialog(time_txt, "INVALID TIME");
328 | return;
329 | }
330 |
331 | try {
332 | String[] arr = {(String) train_combo.getSelectedItem(), time_txt.getText()};
333 | linkedList.insertAtBack(arr);
334 | setTrainScreen();
335 | } catch (IOException e1) {
336 | // TODO Auto-generated catch block
337 | e1.printStackTrace();
338 | }
339 |
340 | }
341 | });
342 | lblTime_1.setHorizontalAlignment(SwingConstants.CENTER);
343 | lblTime_1.setForeground(Color.BLACK);
344 | lblTime_1.setFont(new Font("Press Start 2P", Font.BOLD, 20));
345 | lblTime_1.setBounds(673, 239, 183, 59);
346 | }
347 | return lblTime_1;
348 | }
349 | private JLabel getLblTime_1_1() {
350 | if (lblTime_1_1 == null) {
351 | lblTime_1_1 = new JLabel("DELAY");
352 | lblTime_1_1.addMouseListener(new MouseAdapter() {
353 | @Override
354 | public void mouseClicked(MouseEvent e) {
355 |
356 | //validate
357 | if(remove_txt.getText().isEmpty()){
358 | JOptionPane.showMessageDialog(remove_txt, "ENTER THE INDEX TO REMOVE TEMPORARILY");
359 | return;
360 | }
361 | if(!Character.isDigit(remove_txt.getText().charAt(0))){
362 | JOptionPane.showMessageDialog(remove_txt, "INVALID ENTER A NUMBER");
363 | return;
364 | }
365 | //delete at end given index
366 | int index = Integer.parseInt(remove_txt.getText());
367 | try {
368 | if(!linkedList.isEmpty()) {
369 | queue.enqueue(linkedList.deleteFromMiddle(index-1));
370 | setQueue();
371 | setTrainScreen();
372 | remove_txt.setText("");
373 | }else {
374 | JOptionPane.showMessageDialog(remove_txt, "LIST IS EMPTY");
375 | return;
376 | }
377 | } catch (IOException e1) {
378 | // TODO Auto-generated catch block
379 | e1.printStackTrace();
380 | }
381 | }
382 | });
383 | lblTime_1_1.setHorizontalAlignment(SwingConstants.CENTER);
384 | lblTime_1_1.setForeground(Color.BLACK);
385 | lblTime_1_1.setFont(new Font("Press Start 2P", Font.BOLD, 20));
386 | lblTime_1_1.setBounds(51, 421, 189, 57);
387 | }
388 | return lblTime_1_1;
389 | }
390 | private JLabel getLblTime_1_1_1() {
391 | if (lblTime_1_1_1 == null) {
392 | lblTime_1_1_1 = new JLabel("ADD BACK");
393 | lblTime_1_1_1.addMouseListener(new MouseAdapter() {
394 | @Override
395 | public void mouseClicked(MouseEvent e) {
396 | if(addBack_txt.getText().isEmpty()) {
397 | JOptionPane.showMessageDialog(addBack_txt, "ENTER THE REFRESHED TIME");
398 | return;
399 | }
400 | try {
401 | if(!queue.isEmpty()) {
402 | String[] arr = {queue.dequeue(), addBack_txt.getText()};
403 | linkedList.insertAtBack(arr);
404 | setTrainScreen();
405 | setQueue();
406 | addBack_txt.setText("");
407 | }
408 | else {
409 | JOptionPane.showMessageDialog(addBack_txt, "QUEUE IS EMPTY");
410 | return;
411 | }
412 | } catch (IOException e1) {
413 | // TODO Auto-generated catch block
414 | e1.printStackTrace();
415 | }
416 |
417 | }
418 | });
419 | lblTime_1_1_1.setHorizontalAlignment(SwingConstants.CENTER);
420 | lblTime_1_1_1.setForeground(Color.BLACK);
421 | lblTime_1_1_1.setFont(new Font("Press Start 2P", Font.BOLD, 20));
422 | lblTime_1_1_1.setBounds(51, 583, 189, 57);
423 | }
424 | return lblTime_1_1_1;
425 | }
426 | private JSeparator getSeparator_3() {
427 | if (separator_3 == null) {
428 | separator_3 = new JSeparator();
429 | separator_3.setBounds(447, 376, 232, 11);
430 | }
431 | return separator_3;
432 | }
433 | private JLabel getLblNewLabel_2() {
434 | if (lblNewLabel_2 == null) {
435 | lblNewLabel_2 = new JLabel("");
436 | lblNewLabel_2.setHorizontalAlignment(SwingConstants.CENTER);
437 | lblNewLabel_2.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\index3.png"));
438 | lblNewLabel_2.setBounds(10, 11, 254, 83);
439 | }
440 | return lblNewLabel_2;
441 | }
442 | private JLabel getLblOfficialPortal() {
443 | if (lblOfficialPortal == null) {
444 | lblOfficialPortal = new JLabel("MANAGEMENT");
445 | lblOfficialPortal.setHorizontalAlignment(SwingConstants.CENTER);
446 | lblOfficialPortal.setForeground(Color.BLACK);
447 | lblOfficialPortal.setFont(new Font("Press Start 2P", Font.BOLD, 20));
448 | lblOfficialPortal.setBounds(20, 21, 232, 67);
449 | }
450 | return lblOfficialPortal;
451 | }
452 | private JLabel getLblNewLabel_4() {
453 | if (lblNewLabel_4 == null) {
454 | lblNewLabel_4 = new JLabel("");
455 | lblNewLabel_4.setHorizontalAlignment(SwingConstants.CENTER);
456 | lblNewLabel_4.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\portalTrain.png"));
457 | lblNewLabel_4.setBounds(888, 198, 590, 481);
458 | }
459 | return lblNewLabel_4;
460 | }
461 | private JLabel getLblNewLabel_5() {
462 | if (lblNewLabel_5 == null) {
463 | lblNewLabel_5 = new JLabel("");
464 | lblNewLabel_5.setHorizontalAlignment(SwingConstants.CENTER);
465 | lblNewLabel_5.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\portalTrain2.png"));
466 | lblNewLabel_5.setBounds(890, 225, 588, 73);
467 | }
468 | return lblNewLabel_5;
469 | }
470 | private JLabel getLblNewLabel_5_1_1() {
471 | if (lblNewLabel_5_1 == null) {
472 | lblNewLabel_5_1 = new JLabel("");
473 | lblNewLabel_5_1.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\portalTrain2.png"));
474 | lblNewLabel_5_1.setHorizontalAlignment(SwingConstants.CENTER);
475 | lblNewLabel_5_1.setBounds(890, 309, 588, 73);
476 | }
477 | return lblNewLabel_5_1;
478 | }
479 | private JLabel getLblNewLabel_5_1_1_1() {
480 | if (lblNewLabel_5_1_1 == null) {
481 | lblNewLabel_5_1_1 = new JLabel("");
482 | lblNewLabel_5_1_1.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\portalTrain2.png"));
483 | lblNewLabel_5_1_1.setHorizontalAlignment(SwingConstants.CENTER);
484 | lblNewLabel_5_1_1.setBounds(890, 390, 588, 73);
485 | }
486 | return lblNewLabel_5_1_1;
487 | }
488 | private JLabel getLblNewLabel_5_1_2() {
489 | if (lblNewLabel_5_1_2 == null) {
490 | lblNewLabel_5_1_2 = new JLabel("");
491 | lblNewLabel_5_1_2.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\portalTrain2.png"));
492 | lblNewLabel_5_1_2.setHorizontalAlignment(SwingConstants.CENTER);
493 | lblNewLabel_5_1_2.setBounds(890, 474, 588, 73);
494 | }
495 | return lblNewLabel_5_1_2;
496 | }
497 | private JLabel getLblNewLabel_5_1_3() {
498 | if (lblNewLabel_5_1_3 == null) {
499 | lblNewLabel_5_1_3 = new JLabel("");
500 | lblNewLabel_5_1_3.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\portalTrain2.png"));
501 | lblNewLabel_5_1_3.setHorizontalAlignment(SwingConstants.CENTER);
502 | lblNewLabel_5_1_3.setBounds(890, 558, 588, 73);
503 | }
504 | return lblNewLabel_5_1_3;
505 | }
506 | private JLabel getS1() {
507 | if (S1 == null) {
508 | S1 = new JLabel("1");
509 | S1.setHorizontalAlignment(SwingConstants.CENTER);
510 | S1.setForeground(Color.BLACK);
511 | S1.setFont(new Font("Press Start 2P", Font.BOLD, 15));
512 | S1.setBounds(912, 239, 51, 45);
513 | }
514 | return S1;
515 | }
516 | private JLabel getS2() {
517 | if (S2 == null) {
518 | S2 = new JLabel("2");
519 | S2.setHorizontalAlignment(SwingConstants.CENTER);
520 | S2.setForeground(Color.BLACK);
521 | S2.setFont(new Font("Press Start 2P", Font.BOLD, 15));
522 | S2.setBounds(912, 323, 51, 45);
523 | }
524 | return S2;
525 | }
526 | private JLabel getS3() {
527 | if (S3 == null) {
528 | S3 = new JLabel("3");
529 | S3.setHorizontalAlignment(SwingConstants.CENTER);
530 | S3.setForeground(Color.BLACK);
531 | S3.setFont(new Font("Press Start 2P", Font.BOLD, 15));
532 | S3.setBounds(912, 402, 51, 45);
533 | }
534 | return S3;
535 | }
536 | private JLabel getS4() {
537 | if (S4 == null) {
538 | S4 = new JLabel("4");
539 | S4.setHorizontalAlignment(SwingConstants.CENTER);
540 | S4.setForeground(Color.BLACK);
541 | S4.setFont(new Font("Press Start 2P", Font.BOLD, 15));
542 | S4.setBounds(912, 490, 51, 45);
543 | }
544 | return S4;
545 | }
546 | private JLabel getS5() {
547 | if (S5 == null) {
548 | S5 = new JLabel("5");
549 | S5.setHorizontalAlignment(SwingConstants.CENTER);
550 | S5.setForeground(Color.BLACK);
551 | S5.setFont(new Font("Press Start 2P", Font.BOLD, 15));
552 | S5.setBounds(912, 574, 51, 45);
553 | }
554 | return S5;
555 | }
556 | private JLabel getT1() {
557 | if (T1 == null) {
558 | T1 = new JLabel("");
559 | T1.setHorizontalAlignment(SwingConstants.CENTER);
560 | T1.setForeground(Color.BLACK);
561 | T1.setFont(new Font("Press Start 2P", Font.BOLD, 15));
562 | T1.setBounds(973, 239, 386, 45);
563 | }
564 | return T1;
565 | }
566 | private JLabel getH1() {
567 | if (H1 == null) {
568 | H1 = new JLabel("4:30");
569 | H1.setHorizontalAlignment(SwingConstants.CENTER);
570 | H1.setForeground(Color.BLACK);
571 | H1.setFont(new Font("Press Start 2P", Font.BOLD, 15));
572 | H1.setBounds(1369, 239, 85, 45);
573 | }
574 | return H1;
575 | }
576 | private JLabel getT2() {
577 | if (T2 == null) {
578 | T2 = new JLabel("");
579 | T2.setHorizontalAlignment(SwingConstants.CENTER);
580 | T2.setForeground(Color.BLACK);
581 | T2.setFont(new Font("Press Start 2P", Font.BOLD, 15));
582 | T2.setBounds(973, 323, 386, 45);
583 | }
584 | return T2;
585 | }
586 | private JLabel getT3() {
587 | if (T3 == null) {
588 | T3 = new JLabel("");
589 | T3.setHorizontalAlignment(SwingConstants.CENTER);
590 | T3.setForeground(Color.BLACK);
591 | T3.setFont(new Font("Press Start 2P", Font.BOLD, 15));
592 | T3.setBounds(973, 402, 386, 45);
593 | }
594 | return T3;
595 | }
596 | private JLabel getT4() {
597 | if (T4 == null) {
598 | T4 = new JLabel("");
599 | T4.setHorizontalAlignment(SwingConstants.CENTER);
600 | T4.setForeground(Color.BLACK);
601 | T4.setFont(new Font("Press Start 2P", Font.BOLD, 15));
602 | T4.setBounds(973, 490, 386, 45);
603 | }
604 | return T4;
605 | }
606 | private JLabel getT5() {
607 | if (T5 == null) {
608 | T5 = new JLabel("");
609 | T5.setHorizontalAlignment(SwingConstants.CENTER);
610 | T5.setForeground(Color.BLACK);
611 | T5.setFont(new Font("Press Start 2P", Font.BOLD, 15));
612 | T5.setBounds(973, 574, 386, 45);
613 | }
614 | return T5;
615 | }
616 | private JLabel getH2() {
617 | if (H2 == null) {
618 | H2 = new JLabel("4:30");
619 | H2.setHorizontalAlignment(SwingConstants.CENTER);
620 | H2.setForeground(Color.BLACK);
621 | H2.setFont(new Font("Press Start 2P", Font.BOLD, 15));
622 | H2.setBounds(1369, 323, 85, 45);
623 | }
624 | return H2;
625 | }
626 | private JLabel getH3() {
627 | if (H3 == null) {
628 | H3 = new JLabel("4:30");
629 | H3.setHorizontalAlignment(SwingConstants.CENTER);
630 | H3.setForeground(Color.BLACK);
631 | H3.setFont(new Font("Press Start 2P", Font.BOLD, 15));
632 | H3.setBounds(1369, 402, 85, 45);
633 | }
634 | return H3;
635 | }
636 | private JLabel getH4() {
637 | if (H4 == null) {
638 | H4 = new JLabel("4:30");
639 | H4.setHorizontalAlignment(SwingConstants.CENTER);
640 | H4.setForeground(Color.BLACK);
641 | H4.setFont(new Font("Press Start 2P", Font.BOLD, 15));
642 | H4.setBounds(1369, 490, 85, 45);
643 | }
644 | return H4;
645 | }
646 | private JLabel getH5() {
647 | if (H5 == null) {
648 | H5 = new JLabel("4:30");
649 | H5.setHorizontalAlignment(SwingConstants.CENTER);
650 | H5.setForeground(Color.BLACK);
651 | H5.setFont(new Font("Press Start 2P", Font.BOLD, 15));
652 | H5.setBounds(1369, 574, 85, 45);
653 | }
654 | return H5;
655 | }
656 | private JLabel getLblNewLabel_5_2_1() {
657 | if (lblNewLabel_5_2 == null) {
658 | lblNewLabel_5_2 = new JLabel("");
659 | lblNewLabel_5_2.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\portalTrain2.png"));
660 | lblNewLabel_5_2.setHorizontalAlignment(SwingConstants.CENTER);
661 | lblNewLabel_5_2.setBounds(268, 390, 588, 73);
662 | }
663 | return lblNewLabel_5_2;
664 | }
665 | private JLabel getLblNewLabel_5_3_1() {
666 | if (lblNewLabel_5_3 == null) {
667 | lblNewLabel_5_3 = new JLabel("");
668 | lblNewLabel_5_3.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\portalTrain2.png"));
669 | lblNewLabel_5_3.setHorizontalAlignment(SwingConstants.CENTER);
670 | lblNewLabel_5_3.setBounds(268, 474, 588, 73);
671 | }
672 | return lblNewLabel_5_3;
673 | }
674 | private JLabel getLblNewLabel_5_4_1() {
675 | if (lblNewLabel_5_4 == null) {
676 | lblNewLabel_5_4 = new JLabel("");
677 | lblNewLabel_5_4.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\portalTrain2.png"));
678 | lblNewLabel_5_4.setHorizontalAlignment(SwingConstants.CENTER);
679 | lblNewLabel_5_4.setBounds(268, 558, 588, 73);
680 | }
681 | return lblNewLabel_5_4;
682 | }
683 | private JLabel getLblTime_1_2_5() {
684 | if (lblTime_1_2_5 == null) {
685 | lblTime_1_2_5 = new JLabel("1");
686 | lblTime_1_2_5.setHorizontalAlignment(SwingConstants.CENTER);
687 | lblTime_1_2_5.setForeground(Color.BLACK);
688 | lblTime_1_2_5.setFont(new Font("Press Start 2P", Font.BOLD, 15));
689 | lblTime_1_2_5.setBounds(297, 402, 51, 45);
690 | }
691 | return lblTime_1_2_5;
692 | }
693 | private JLabel getLT1() {
694 | if (LT1 == null) {
695 | LT1 = new JLabel("");
696 | LT1.setHorizontalAlignment(SwingConstants.CENTER);
697 | LT1.setForeground(Color.BLACK);
698 | LT1.setFont(new Font("Press Start 2P", Font.BOLD, 15));
699 | LT1.setBounds(358, 402, 481, 45);
700 | }
701 | return LT1;
702 | }
703 | private JLabel getLblTime_1_2_6() {
704 | if (lblTime_1_2_6 == null) {
705 | lblTime_1_2_6 = new JLabel("2");
706 | lblTime_1_2_6.setHorizontalAlignment(SwingConstants.CENTER);
707 | lblTime_1_2_6.setForeground(Color.BLACK);
708 | lblTime_1_2_6.setFont(new Font("Press Start 2P", Font.BOLD, 15));
709 | lblTime_1_2_6.setBounds(297, 490, 51, 45);
710 | }
711 | return lblTime_1_2_6;
712 | }
713 | private JLabel getLT2() {
714 | if (LT2 == null) {
715 | LT2 = new JLabel("");
716 | LT2.setHorizontalAlignment(SwingConstants.CENTER);
717 | LT2.setForeground(Color.BLACK);
718 | LT2.setFont(new Font("Press Start 2P", Font.BOLD, 15));
719 | LT2.setBounds(358, 490, 481, 45);
720 | }
721 | return LT2;
722 | }
723 | private JLabel getLblTime_1_2_7() {
724 | if (lblTime_1_2_7 == null) {
725 | lblTime_1_2_7 = new JLabel("3");
726 | lblTime_1_2_7.setHorizontalAlignment(SwingConstants.CENTER);
727 | lblTime_1_2_7.setForeground(Color.BLACK);
728 | lblTime_1_2_7.setFont(new Font("Press Start 2P", Font.BOLD, 15));
729 | lblTime_1_2_7.setBounds(297, 574, 51, 45);
730 | }
731 | return lblTime_1_2_7;
732 | }
733 | private JLabel getLT3() {
734 | if (LT3 == null) {
735 | LT3 = new JLabel("");
736 | LT3.setHorizontalAlignment(SwingConstants.CENTER);
737 | LT3.setForeground(Color.BLACK);
738 | LT3.setFont(new Font("Press Start 2P", Font.BOLD, 15));
739 | LT3.setBounds(358, 574, 481, 45);
740 | }
741 | return LT3;
742 | }
743 |
744 | private void setTrainScreen() throws IOException {
745 | ArrayList trains = arrays.getTrainScreen();
746 |
747 | int length = trains.size();
748 | if(length==0) {
749 | S1.setText("");
750 | S2.setText("");
751 | S3.setText("");
752 | S4.setText("");
753 | S5.setText("");
754 | T1.setText("");
755 | H1.setText("");
756 | T2.setText("");
757 | H2.setText("");
758 | T3.setText("");
759 | H3.setText("");
760 | T4.setText("");
761 | H4.setText("");
762 | T5.setText("");
763 | H5.setText("");
764 | }
765 | else if(length<=1) {
766 | S1.setText("1");
767 | S2.setText("");
768 | S3.setText("");
769 | S4.setText("");
770 | S5.setText("");
771 | T1.setText(trains.get(0)[0]);
772 | H1.setText(trains.get(0)[1]);
773 | T2.setText("");
774 | H2.setText("");
775 | T3.setText("");
776 | H3.setText("");
777 | T4.setText("");
778 | H4.setText("");
779 | T5.setText("");
780 | H5.setText("");
781 | }
782 |
783 | else if(length<=2) {
784 | S1.setText("1");
785 | S2.setText("2");
786 | S3.setText("");
787 | S4.setText("");
788 | S5.setText("");
789 | T1.setText(trains.get(0)[0]);
790 | H1.setText(trains.get(0)[1]);
791 | T2.setText(trains.get(1)[0]);
792 | H2.setText(trains.get(1)[1]);
793 | T3.setText("");
794 | H3.setText("");
795 | T4.setText("");
796 | H4.setText("");
797 | T5.setText("");
798 | H5.setText("");
799 | }
800 | else if(length<=3) {
801 | S1.setText("1");
802 | S2.setText("2");
803 | S3.setText("3");
804 | S4.setText("");
805 | S5.setText("");
806 | T1.setText(trains.get(0)[0]);
807 | H1.setText(trains.get(0)[1]);
808 | T2.setText(trains.get(1)[0]);
809 | H2.setText(trains.get(1)[1]);
810 | T3.setText(trains.get(2)[0]);
811 | H3.setText(trains.get(2)[1]);
812 | T4.setText("");
813 | H4.setText("");
814 | T5.setText("");
815 | H5.setText("");
816 | }
817 | else if(length<=4) {
818 | S1.setText("1");
819 | S2.setText("2");
820 | S3.setText("3");
821 | S4.setText("4");
822 | S5.setText("");
823 | T1.setText(trains.get(0)[0]);
824 | H1.setText(trains.get(0)[1]);
825 | T2.setText(trains.get(1)[0]);
826 | H2.setText(trains.get(1)[1]);
827 | T3.setText(trains.get(2)[0]);
828 | H3.setText(trains.get(2)[1]);
829 | T4.setText(trains.get(3)[0]);
830 | H4.setText(trains.get(3)[1]);
831 | T5.setText("");
832 | H5.setText("");
833 | }
834 | else {
835 | S1.setText("1");
836 | S2.setText("2");
837 | S3.setText("3");
838 | S4.setText("4");
839 | S5.setText("5");
840 | T1.setText(trains.get(0)[0]);
841 | H1.setText(trains.get(0)[1]);
842 | T2.setText(trains.get(1)[0]);
843 | H2.setText(trains.get(1)[1]);
844 | T3.setText(trains.get(2)[0]);
845 | H3.setText(trains.get(2)[1]);
846 | T4.setText(trains.get(3)[0]);
847 | H4.setText(trains.get(3)[1]);
848 | T5.setText(trains.get(4)[0]);
849 | H5.setText(trains.get(4)[1]);
850 | }
851 |
852 | }
853 |
854 | //method to automatically display the train names from the
855 | private void giveTrainNames() throws IOException {
856 | ArrayList trains = arrays.getTrains();
857 | ArrayList trainNames = new ArrayList();
858 | for (String[] x : trains) {
859 | trainNames.add(x[1]);
860 | }
861 | train_combo.setModel(new DefaultComboBoxModel(new String[] {"...", trainNames.get(0), trainNames.get(1), trainNames.get(2), trainNames.get(3), trainNames.get(4), trainNames.get(5), trainNames.get(6) }));
862 | }
863 |
864 | private JComboBox getTrain_combo() {
865 | if (train_combo == null) {
866 | train_combo = new JComboBox();
867 | train_combo.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
868 | train_combo.setBounds(31, 263, 460, 45);
869 | }
870 | return train_combo;
871 | }
872 | private JTextField getRemove_txt() {
873 | if (remove_txt == null) {
874 | remove_txt = new JTextField();
875 | remove_txt.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
876 | remove_txt.setColumns(10);
877 | remove_txt.setBounds(53, 333, 187, 57);
878 | }
879 | return remove_txt;
880 | }
881 | private JTextField getAddBack_txt() {
882 | if (addBack_txt == null) {
883 | addBack_txt = new JTextField();
884 | addBack_txt.setFont(new Font("Press Start 2P", Font.PLAIN, 20));
885 | addBack_txt.setColumns(10);
886 | addBack_txt.setBounds(51, 500, 189, 57);
887 | }
888 | return addBack_txt;
889 | }
890 |
891 | private void setQueue() throws IOException {
892 | ArrayList alist = fileHandler.getTrainQueue();
893 | if(alist.size()==0) {
894 | LT1.setText("");
895 | LT2.setText("");
896 | LT3.setText("");
897 | }
898 | else if(alist.size()==1) {
899 | LT1.setText(alist.get(0));
900 | LT2.setText("");
901 | LT3.setText("");
902 | }
903 | else if(alist.size()==2) {
904 | LT1.setText(alist.get(0));
905 | LT2.setText(alist.get(1));
906 | LT3.setText("");
907 | }
908 | else {
909 | LT1.setText(alist.get(0));
910 | LT2.setText(alist.get(1));
911 | LT3.setText(alist.get(2));
912 | }
913 | }
914 | private JLabel getLblTime_1_2() {
915 | if (lblTime_1_2 == null) {
916 | lblTime_1_2 = new JLabel("REMOVE");
917 | lblTime_1_2.addMouseListener(new MouseAdapter() {
918 | @Override
919 | public void mouseClicked(MouseEvent e) {
920 | try {
921 | if(!linkedList.isEmpty()) {
922 | linkedList.deleteFromBeginning();
923 | setTrainScreen();
924 | }else {
925 | JOptionPane.showMessageDialog(time_txt, "LIST IS EMPTY");
926 | return;
927 | }
928 |
929 | } catch (IOException e1) {
930 | // TODO Auto-generated catch block
931 | e1.printStackTrace();
932 | }
933 | }
934 | });
935 | lblTime_1_2.setHorizontalAlignment(SwingConstants.CENTER);
936 | lblTime_1_2.setForeground(Color.BLACK);
937 | lblTime_1_2.setFont(new Font("Press Start 2P", Font.BOLD, 20));
938 | lblTime_1_2.setBounds(673, 153, 183, 59);
939 | }
940 | return lblTime_1_2;
941 | }
942 | private JLabel getLblNewLabel_1_2() {
943 | if (lblNewLabel_1_2 == null) {
944 | lblNewLabel_1_2 = new JLabel("");
945 | lblNewLabel_1_2.setIcon(new ImageIcon("C:\\Users\\abhin\\Desktop\\JAVA\\workspace\\Railway_Management_System\\assets\\images\\Asset 1ldpi.png"));
946 | lblNewLabel_1_2.setHorizontalAlignment(SwingConstants.CENTER);
947 | lblNewLabel_1_2.setBounds(658, 139, 211, 84);
948 | }
949 | return lblNewLabel_1_2;
950 | }
951 | }
952 |
953 |
954 |
--------------------------------------------------------------------------------