-
Notifications
You must be signed in to change notification settings - Fork 0
/
SearchPanel.java
52 lines (41 loc) · 1.21 KB
/
SearchPanel.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
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
public class SearchPanel extends JPanel implements ActionListener
{
JLabel lbl;
JComboBox combo;
JButton btn;
String str;
public SearchPanel(String str)
{
setLayout(new FlowLayout() );
lbl=new JLabel("Select Value");
this.str=str;
combo=new JComboBox(GetValue.getValue(str));
btn=new JButton("Search");
add(lbl);add(combo);add(btn);
btn.addActionListener(this);
}
@Override
public void actionPerformed(ActionEvent arg0) {
String value=(String)combo.getSelectedItem();
System.out.println(str+":::"+value);
GetValue.searchValuesBy(str, value);
JFrame frm=new JFrame();
frm.setSize(1000, 400);
frm.setLocationRelativeTo(this);
JTable table=new JTable(GetValue.records, GetValue.colNames);
JScrollPane pane=new JScrollPane(table);
frm.add(pane);
frm.setVisible(true);
}
}