-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearchinfo.java
More file actions
239 lines (216 loc) · 9.17 KB
/
searchinfo.java
File metadata and controls
239 lines (216 loc) · 9.17 KB
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
import java.sql.*;
import javax.swing.JOptionPane;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author User
*/
public class searchinfo extends javax.swing.JFrame {
/**
* Creates new form searchinfo
*/
public searchinfo() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jTF1 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
jTF2 = new javax.swing.JTextField();
jTF3 = new javax.swing.JTextField();
jTF4 = new javax.swing.JTextField();
jTF5 = new javax.swing.JTextField();
jTF6 = new javax.swing.JTextField();
jTF7 = new javax.swing.JTextField();
jTF8 = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(null);
getContentPane().add(jLabel1);
jLabel1.setBounds(618, 40, 0, 0);
jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 36)); // NOI18N
jLabel2.setText("SEARCH DETAILS");
getContentPane().add(jLabel2);
jLabel2.setBounds(320, 30, 315, 42);
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 20)); // NOI18N
jLabel3.setText("ENTER YOUR BOOKING NUMBER");
getContentPane().add(jLabel3);
jLabel3.setBounds(110, 120, 350, 25);
getContentPane().add(jTF1);
jTF1.setBounds(520, 110, 280, 40);
jButton1.setBackground(new java.awt.Color(102, 255, 0));
jButton1.setFont(new java.awt.Font("Tempus Sans ITC", 1, 24)); // NOI18N
jButton1.setText("SEARCH DETAILS");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
getContentPane().add(jButton1);
jButton1.setBounds(350, 190, 240, 60);
getContentPane().add(jLabel4);
jLabel4.setBounds(40, 20, 0, 0);
jLabel7.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
jLabel7.setText("NAME");
getContentPane().add(jLabel7);
jLabel7.setBounds(20, 350, 50, 14);
jLabel8.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
jLabel8.setText("CONTACT NUMBER");
getContentPane().add(jLabel8);
jLabel8.setBounds(130, 350, 110, 14);
jLabel5.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
jLabel5.setText("ROOM NO");
getContentPane().add(jLabel5);
jLabel5.setBounds(300, 350, 60, 14);
jLabel10.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
jLabel10.setText("NO OF DAYS");
getContentPane().add(jLabel10);
jLabel10.setBounds(440, 350, 80, 14);
jLabel11.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
jLabel11.setText("TOTAL AMOUNT");
getContentPane().add(jLabel11);
jLabel11.setBounds(560, 350, 90, 14);
jLabel12.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
jLabel12.setText("ROOM TYPE");
getContentPane().add(jLabel12);
jLabel12.setBounds(700, 350, 70, 14);
jLabel13.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
jLabel13.setText("BEDTYPE");
getContentPane().add(jLabel13);
jLabel13.setBounds(810, 350, 50, 14);
jTF2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTF2ActionPerformed(evt);
}
});
getContentPane().add(jTF2);
jTF2.setBounds(20, 380, 70, 30);
getContentPane().add(jTF3);
jTF3.setBounds(130, 380, 110, 30);
getContentPane().add(jTF4);
jTF4.setBounds(290, 380, 90, 30);
getContentPane().add(jTF5);
jTF5.setBounds(430, 380, 80, 30);
getContentPane().add(jTF6);
jTF6.setBounds(550, 380, 110, 30);
getContentPane().add(jTF7);
jTF7.setBounds(700, 380, 80, 30);
getContentPane().add(jTF8);
jTF8.setBounds(810, 380, 90, 30);
jLabel6.setIcon(new javax.swing.ImageIcon("C:\\Users\\User\\Desktop\\pictures\\calicut.jpg")); // NOI18N
getContentPane().add(jLabel6);
jLabel6.setBounds(0, 0, 940, 430);
pack();
}// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try{
Class.forName("java.sql.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost/rishita","root","opjs");
Statement stmt=con.createStatement();
int a=Integer.parseInt(jTF1.getText());
String q="select name,contact_no,room_no,no_of_days,total_amount,room_type,bed_type from imperial where booking_no = "+a+" ;";
ResultSet rs=stmt.executeQuery(q);
rs.next();
String b=rs.getString("name");
long c= rs.getLong("contact_no");
int rm=rs.getInt("room_no");
int d=rs.getInt("no_of_days");
String rt=rs.getString("room_type");
String bt=rs.getString("bed_type");
int f=rs.getInt("total_amount");
jTF2.setText(""+b);
jTF3.setText(""+c);
jTF4.setText(""+rm);
jTF5.setText(""+d);
jTF6.setText(""+f);
jTF7.setText(""+rt);
jTF8.setText(""+bt);
rs.close();
stmt.close();
con.close();
}
catch(Exception e){
JOptionPane.showMessageDialog(null,e.getMessage());
}
}
private void jTF2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(searchinfo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(searchinfo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(searchinfo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(searchinfo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new searchinfo().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JTextField jTF1;
private javax.swing.JTextField jTF2;
private javax.swing.JTextField jTF3;
private javax.swing.JTextField jTF4;
private javax.swing.JTextField jTF5;
private javax.swing.JTextField jTF6;
private javax.swing.JTextField jTF7;
private javax.swing.JTextField jTF8;
// End of variables declaration
}