-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathFrmSearchPCategory.java
More file actions
84 lines (76 loc) · 2.45 KB
/
FrmSearchPCategory.java
File metadata and controls
84 lines (76 loc) · 2.45 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
package hms;
import javax.swing.*;
import java.awt.*;
import java.sql.*;
import java.awt.event.*;
public class FrmSearchPCategory extends JInternalFrame
{
/**
*
*/
private static final long serialVersionUID = 1L;
JLabel lblSearch,lblSelect;
JTextField jtfSearch;
JComboBox<String> jcbSelect;
JButton btnSearch,btnCancel;
DConnection dc;
ResultSet rst;
FrmPCategories fpc;
FrmSearchPCategory(FrmPCategories fpc)
{
super("Search",false,true,false,false);
this.fpc=fpc;
setLayout(new GridLayout(3,2));
lblSearch=new JLabel("Search");
lblSearch.setForeground(new Color(64,0,0));
lblSearch.setFont(new Font(Font.SERIF,Font.ITALIC+Font.BOLD,18));
add(lblSearch);
jtfSearch=new JTextField();
jtfSearch.setForeground(new Color(49,49,49));
jtfSearch.setFont(new Font(Font.SERIF,Font.ITALIC+Font.BOLD,18));
add(jtfSearch);
lblSelect=new JLabel("Select");
lblSelect.setForeground(new Color(64,0,0));
lblSelect.setFont(new Font(Font.SERIF,Font.ITALIC+Font.BOLD,18));
add(lblSelect);
jcbSelect=new JComboBox<String>();
jcbSelect.setForeground(new Color(49,49,49));
jcbSelect.setFont(new Font(Font.SERIF,Font.ITALIC+Font.BOLD,18));
jcbSelect.addItem("pcat_name");
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();
FrmPCategories.query="from pcat where "+select+" = '"+value+"'";
dispose();
fpc.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);
}
}