-
Notifications
You must be signed in to change notification settings - Fork 0
/
JourneyDetails.java
82 lines (59 loc) · 2.18 KB
/
JourneyDetails.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
package AMS;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
import net.proteanit.sql.DbUtils;
public class JourneyDetails extends JFrame implements ActionListener{
JTable table;
JTextField pnr;
JButton show;
public JourneyDetails(){
setTitle("Journey Details");
setSize(400,300);
getContentPane().setBackground(Color.WHITE);
setLayout(null);
ImageIcon img=new ImageIcon(ClassLoader.getSystemResource("AMS/icons/f2.jpg"));
JLabel image=new JLabel(img);
image.setBounds(0,0,1800,400);
add(image);
JLabel lblpnr=new JLabel("PNR Details");
lblpnr.setFont(new Font("Arial",Font.BOLD,16));
lblpnr.setBounds(50,50,100,25);
image.add(lblpnr);
pnr=new JTextField();
pnr.setBounds(160,50,120,25);
image.add(pnr);
show=new JButton("Show Details");
show.setBackground(Color.BLACK);
show.setForeground(Color.WHITE);
show.setBounds(290,50,120,25);
show.addActionListener(this);
image.add(show);
table=new JTable();
JScrollPane jsp=new JScrollPane(table);
jsp.setBounds(0,100,800,150);
jsp.setBackground(Color.WHITE);
image.add(jsp);
setSize(800,400);
setLocation(275,175);
setVisible(true);
}
public void actionPerformed(ActionEvent ae){
try{
ConnectionClass con= new ConnectionClass();
ResultSet rs= con.stm.executeQuery("select * from reservation where PNR= '"+pnr.getText()+"'");
if(!rs.isBeforeFirst()){
JOptionPane.showMessageDialog(null, "No Information Found");
return;
}
table.setModel(DbUtils.resultSetToTableModel(rs));
}
catch(Exception e){
e.printStackTrace();
}
}
public static void main(String args[]){
new JourneyDetails();
}
}