-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConsultaCliente.java
99 lines (74 loc) · 2.63 KB
/
ConsultaCliente.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
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
import javax.swing.*;
import java.awt.event.*;
import java.util.*;
import java.sql.*;
public class ConsultaCliente extends JFrame implements ActionListener{
private Connection conexao;
Control_Clientes cl = new Control_Clientes();
Cliente c = new Cliente();
private JLabel jlCodcliente = new JLabel ("Codigo do Cliente");
private JTextField jtfCodCliente = new JTextField (20);
private JLabel jlCpf = new JLabel ("CPF do Cliente");
private JTextField jtfCpf = new JTextField (12);
private JLabel jlNome = new JLabel ("Nome do Cliente");
private JTextField jtfNome = new JTextField (100);
private JLabel jlTelefone = new JLabel ("Telefone do Cliente");
private JTextField jtfTelefone = new JTextField (20);
private JRadioButton s = new JRadioButton ("Sim");
private JRadioButton n = new JRadioButton ("Nao");
private JButton jbConfirma = new JButton();
private ButtonGroup bgrupo = new ButtonGroup();
ConsultaCliente(){
this.setTitle("Consultar Clientes");
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
this.setSize(400,400);
this.setLocationRelativeTo(null);
this.setLayout(null);
jlCodcliente.setBounds(20,10,100,10);
add(jlCodcliente);
jtfCodCliente.setBounds(20,30,130,20);
jtfCodCliente.setToolTipText("Digite o codigo do cliente");
this.add(jtfCodCliente);
jlCpf.setBounds(20,60,100,20);
add(jlCpf);
jtfCpf.setBounds(20,80,100,20);
jtfCpf.setToolTipText("Digite o codigo do cliente para aparecer os dados do CPF");
this.add(jtfCpf);
jlNome.setBounds(20,110,100,20);
add(jlNome);
jtfNome.setBounds(20,130,100,20);
jtfNome.setToolTipText("Digite o codigo do cliente para aparecer os dados do nome");
this.add(jtfNome);
jlTelefone.setBounds(20,160,100,20);
add(jlTelefone);
jtfTelefone.setBounds(20,180,100,20);
jtfTelefone.setToolTipText("Digite o codigo do cliente para aparecer os dados do telefone");
this.add(jtfTelefone);
s.setBounds(20,210,100,20);
n.setBounds(20,230,100,20);
this.add(s);
this.add(n);
bgrupo.add(s);
bgrupo.add(n);
jbConfirma.setText("Confirma");
jbConfirma.setBounds(20,250,100,20);
jbConfirma.addActionListener(this);
jbConfirma.setMnemonic(KeyEvent.VK_S);
this.add(jbConfirma);
this.setVisible(true);
}
public void actionPerformed(ActionEvent event){
if (event.getSource()==jbConfirma){
if (s.isSelected()){
c = cl.pesquisaCliente(jtfCodCliente.getText());
jtfCodCliente.setText(c.getCodcliente());
jtfNome.setText(c.getNome());
jtfCpf.setText(c.getCpf());
jtfTelefone.setText(c.getTelefone());
}
if (n.isSelected()){
jtfCodCliente.setText("");
}
}
}
}