-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist_customers.java
More file actions
61 lines (58 loc) · 1.59 KB
/
Copy pathlist_customers.java
File metadata and controls
61 lines (58 loc) · 1.59 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
/*
* 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.
*/
package chemist_shop;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
public class list_customers extends JFrame implements ActionListener
{
JTable j1;
JButton b1;
String h[]={"Customer ID", "Name", "Date", "Age"};
String d[][]=new String[15][4];
int i=0, j=0;
public list_customers()
{
super("Users");
setSize(1000, 1000);
setLocation(150, 150);
try
{
String q = "SELECT * FROM CUSTOMER";
conn c2 = new conn();
ResultSet rs = c2.s.executeQuery(q);
while(rs.next())
{
d[i][j++]=rs.getString("CUSTOMER_ID");
d[i][j++]=rs.getString("NAME");
d[i][j++]=rs.getString("START_DATE");
d[i][j]=rs.getString("AGE");
i++;
j=0;
}
j1 = new JTable(d, h);
}
catch(Exception e){}
b1 = new JButton("Print");
add(b1, "South");
JScrollPane s1 = new JScrollPane(j1);
add(s1);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
try
{
j1.print();
}
catch(Exception e){}
}
public static void main(String s[])
{
new list_customers().setVisible(true);
}
}