-
Notifications
You must be signed in to change notification settings - Fork 0
/
EditaCliente.java
125 lines (91 loc) · 3.15 KB
/
EditaCliente.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import javax.swing.*;
import java.awt.event.*;
import java.util.*;
import java.sql.*;
public class EditaCliente 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");
private JTextField jtfCpf = new JTextField (11);
private JLabel jlNome = new JLabel ("Nome");
private JTextField jtfNome = new JTextField (100);
private JLabel jlTelefone = new JLabel ("Telefone");
private JTextField jtfTelefone = new JTextField (11);
private JRadioButton s = new JRadioButton ("Sim");
private JRadioButton n = new JRadioButton ("Nao");
private JButton jbConfirma = new JButton();
private JButton jbVerifica = new JButton();
private ButtonGroup bgrupo = new ButtonGroup();
EditaCliente(){
setTitle("Atualizar dados de Cliente");
this.setDefaultCloseOperation(WindowConstants.DISPOSE_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);
jbVerifica.setText("Verifica");
jbVerifica.setBounds(20,280,100,20);
jbVerifica.addActionListener(this);
jbVerifica.setMnemonic(KeyEvent.VK_V);
this.add(jbVerifica);
//this.setVisible(false);
}
public void actionPerformed(ActionEvent event){
if(event.getSource()==jbVerifica){
c = cl.pesquisaCliente(jtfCodCliente.getText());
jtfCpf.setText(c.getCpf());
jtfCodCliente.setText(c.getCodcliente());
jtfNome.setText(c.getNome());
jtfTelefone.setText(c.getTelefone());
}
if (event.getSource()==jbConfirma){
if (s.isSelected()){
c.setCodcliente(jtfCodCliente.getText());
c.setCpf(jtfCpf.getText());
c.setNome(jtfNome.getText());
c.setTelefone(jtfTelefone.getText());
jtfCodCliente.setText("");
jtfCpf.setText("");
jtfNome.setText("");
jtfTelefone.setText("");
cl.altera(c);
}
if (n.isSelected()){
jtfCodCliente.setText("");
}
}
}
}