-
Notifications
You must be signed in to change notification settings - Fork 0
/
n_ReferralIdPage.java
186 lines (184 loc) · 7.01 KB
/
n_ReferralIdPage.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
package finalproject;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class n_ReferralIdPage extends JFrame implements ActionListener
{ private Container container = getContentPane();
private JPanel headerPanel = new JPanel();
private JLabel headerTitleLabel = new JLabel(" BOOTCAMP E-PASS");
private JLabel passTitleLabel = new JLabel("Your E-Pass Reference ID");
private JLabel noteLabel = new JLabel("NOTE:");
private JTextArea screenShotTextArea = new JTextArea("Take screenshot of your epass 'Reference ID'.");
private JTextArea veiwStatusTextArea = new JTextArea("Go to 'View Status' to check the status of your E-Pass.");
private JPanel bodyPanel = new JPanel();
private JLabel referenceIdLabel = new JLabel("");
private JLabel epassLabel = new JLabel("");
private JButton logoutButton=new JButton("Log out");
n_ReferralIdPage(){
setLabels();
setLayoutManager();
setLocationAndSize();
setHeaderPanel();
setContainerLabels();
setFontAndColor();
setBodyPanel();
setLogoutButton();
addComponentsToContainer();
setFrame();
}
private void setLabels()
{ int id=0;
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost/project","root0","root");
//Connection con=DriverManager.getConnection("jdbc:sqlite:D:\\sqllitedb\\project.db");
Statement st=con.createStatement();
con.setAutoCommit(true);
String type="";
String query1="select * from interstatepagetable";
ResultSet r1= st.executeQuery(query1);
while(r1.next())
{ String str=r1.getString("id");
int n=Integer.parseInt(str.substring(2,str.length()));
if(n>id)
{id=n;
type=r1.getString("id");
}
}
String query2="select * from withinstatepagetable";
ResultSet r2= st.executeQuery(query2);
while(r2.next())
{ String str=r2.getString("id");
int n=Integer.parseInt(str.substring(2,str.length()));
if(n>id)
{id=n;
type=r2.getString("id");
}
}
String query3="select * from emergencypagetable";
ResultSet r3 = st.executeQuery(query3);
while(r3.next())
{ String str=r3.getString("id");
int n=Integer.parseInt(str.substring(2,str.length()));
if(n>id)
{id=n;
type=r3.getString("id");
}
}
String query4="select * from OrganisationalPage";
ResultSet r4= st.executeQuery(query4);
while(r4.next())
{ String str=r4.getString("id");
int n=Integer.parseInt(str.substring(2,str.length()));
if(n>id)
{id=n;
type=r4.getString("id");
}
}
String tablename="";
if(type.substring(0,2).equals("IS"))
{ tablename="Inter State e-pass";
}
if(type.substring(0,2).equals("WS"))
{ tablename="Within State e-pass";
}
if(type.substring(0,2).equals("EM"))
{ tablename="Emergency e-pass";
}
if(type.substring(0,2).equals("OR"))
{ tablename="Organisational e-pass";
}
referenceIdLabel.setText(type);
epassLabel.setText(tablename);
}
catch(Exception e4)
{System.out.print(e4+"e");
}
}
private void setLayoutManager(){
container.setBackground(Color.WHITE);
container.setLayout(null);
}
private void setHeaderPanel(){
headerPanel.setBackground(new Color(251,5,37));
headerPanel.setLayout(new GridLayout(1,1,0,0));
ImageIcon iconLogo = new ImageIcon(new ImageIcon("C:\\Users\\Admin\\Desktop\\icon.png").getImage().getScaledInstance(75,75, Image.SCALE_SMOOTH));
headerTitleLabel.setIcon(iconLogo);
headerTitleLabel.setFont(new Font("Roboto", Font.BOLD,26));
headerTitleLabel.setForeground(Color.white);
headerPanel.add(headerTitleLabel);
}
private void setBodyPanel(){
referenceIdLabel.setBounds(0, 23, 460, 50);
epassLabel.setBounds(0, 73, 460, 50);
referenceIdLabel.setFont(new Font("Roboto",Font.BOLD,36));
epassLabel.setFont(new Font("Roboto",Font.BOLD,32));
bodyPanel.setBorder(BorderFactory.createMatteBorder(3, 3, 3, 3,new Color(251,5,37)));
referenceIdLabel.setForeground(new Color(51,69,187));
epassLabel.setForeground(Color.BLACK);
referenceIdLabel.setHorizontalAlignment(JLabel.CENTER);
epassLabel.setHorizontalAlignment(JLabel.CENTER);
bodyPanel.add(epassLabel);
bodyPanel.add(referenceIdLabel);
bodyPanel.setLayout(null);
}
private void setContainerLabels(){
passTitleLabel.setBounds(0,105,870,30);
noteLabel.setBounds(155,155,80,407);
screenShotTextArea.setBounds(227,344,500,40);
veiwStatusTextArea.setBounds(227,384,520,60);
screenShotTextArea.setEditable(false);
screenShotTextArea.setLineWrap(true);
veiwStatusTextArea.setEditable(false);
veiwStatusTextArea.setLineWrap(true);
passTitleLabel.setHorizontalAlignment(JLabel.CENTER);
}
private void setFontAndColor(){
passTitleLabel.setFont(new Font("Roboto", Font.BOLD,23));
noteLabel.setFont(new Font("Roboto", Font.BOLD,20));
screenShotTextArea.setFont(new Font("Roboto", Font.PLAIN,20));
veiwStatusTextArea.setFont(new Font("Roboto", Font.PLAIN,20));
noteLabel.setForeground(new Color(51,69,187));
}
private void setLogoutButton(){
logoutButton.setFont(new Font("Roboto", Font.BOLD,17));
logoutButton.setBounds(350,455,150,40);
logoutButton.addActionListener(this);
logoutButton.setBackground(Color.BLACK);
logoutButton.setForeground(Color.WHITE);
container.add(logoutButton);
}
private void setLocationAndSize(){
headerPanel.setBounds(0, 0, 870, 70);
bodyPanel.setBounds(210,155,460,150);
}
private void addComponentsToContainer(){
container.add(headerPanel);
container.add(bodyPanel);
container.add(passTitleLabel);
container.add(noteLabel);
container.add(screenShotTextArea);
container.add(veiwStatusTextArea);
}
private void setFrame(){
Image icon = Toolkit.getDefaultToolkit().getImage("C:\\Users\\Admin\\Desktop\\icon.png");
setIconImage(icon);
setSize(870, 610);
setLocationRelativeTo(null);
setTitle("E-Pass Reference ID");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setResizable(false);
setVisible(true);
}
public void actionPerformed(ActionEvent e)
{ if(e.getSource()==logoutButton)
{
new a_HomePage();
}
}
}