-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathFrmSearchRoomCategory.java
More file actions
85 lines (77 loc) · 2.52 KB
/
FrmSearchRoomCategory.java
File metadata and controls
85 lines (77 loc) · 2.52 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
package hms;
import javax.swing.*;
import java.awt.*;
import java.sql.*;
import java.awt.event.*;
public class FrmSearchRoomCategory extends JInternalFrame
{
/**
*
*/
private static final long serialVersionUID = 1L;
JLabel lblSearch,lblSelect;
JTextField jtfSearch;
JComboBox<String> jcbSelect;
JButton btnSearch,btnCancel;
DConnection dc;
ResultSet rst;
FrmRoomCategory frc;
FrmSearchRoomCategory(FrmRoomCategory frc)
{
super("Search",false,true,false,false);
this.frc=frc;
setLayout(new GridLayout(3,2));
lblSearch=new JLabel("Search");
lblSearch.setForeground(new Color(128,0,64));
lblSearch.setFont(new Font(Font.SERIF,Font.ITALIC+Font.BOLD,18));
add(lblSearch);
jtfSearch=new JTextField();
jtfSearch.setForeground(new Color(106,106,106));
jtfSearch.setFont(new Font(Font.SERIF,Font.ITALIC+Font.BOLD,18));
add(jtfSearch);
lblSelect=new JLabel("Select");
lblSelect.setForeground(new Color(128,0,64));
lblSelect.setFont(new Font(Font.SERIF,Font.ITALIC+Font.BOLD,18));
add(lblSelect);
jcbSelect=new JComboBox<String>();
jcbSelect.setForeground(new Color(106,106,106));
jcbSelect.setFont(new Font(Font.SERIF,Font.ITALIC+Font.BOLD,18));
jcbSelect.addItem("roomcat_name");
jcbSelect.addItem("room_charge");
add(jcbSelect);
btnSearch=new JButton("Search");
btnSearch.setForeground(Color.white);
btnSearch.setBackground(Color.blue);
btnSearch.setFont(new Font(Font.SERIF,Font.ITALIC,22));
btnSearch.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ae)
{
dc=new DConnection();
String select=(String)jcbSelect.getSelectedItem();
String value=jtfSearch.getText();
FrmRoomCategory.query="from roomcat where "+select+" = '"+value+"'";
dispose();
frc.reload();
}
});
add(btnSearch);
btnCancel=new JButton("Cancel");
btnCancel.setForeground(Color.white);
btnCancel.setBackground(Color.red);
btnCancel.setFont(new Font(Font.SERIF,Font.ITALIC,22));
btnCancel.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ae)
{
dispose();
}
});
add(btnCancel);
setSize(300,150);
setLocation(CommonMethods.getCenterPoint(getSize()));
setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);
setResizable(false);
setVisible(true);
}
}