-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCadastroAtendente.java
84 lines (62 loc) · 2.09 KB
/
CadastroAtendente.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
import javax.swing.*;
import java.awt.event.*;
import java.util.*;
import java.sql.*;
class CadastroAtendente extends JFrame implements ActionListener {
private Connection conexao;
Controle_Atendente ca = new Controle_Atendente();
Atendente a = new Atendente();
private JLabel jlcodatendente = new JLabel ("O Codigo do Atendente");
private JTextField jtfcodatendente = new JTextField (20);
private JLabel jlcomissao = new JLabel ("Comissao");
private JTextField jtfcomissao = new JTextField (11);
private JLabel jlNome = new JLabel ("Nome");
private JTextField jtfNome = new JTextField (100);
private JButton gravar = new JButton ("Gravar");
private JButton limpar = new JButton ("Limpar");
CadastroAtendente(){
setTitle("Janela de Atendentes");
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
setSize(600,400);
setLocationRelativeTo(null);
setLayout(null);
jlcodatendente.setBounds(20,10,220,10);
add(jlcodatendente);
jtfcodatendente.setBounds(20,40,130,20);
jtfcodatendente.setToolTipText("Digite o codigo do atendente");
this.add(jtfcodatendente);
jlcomissao.setBounds(20,60,110,20);
add(jlcomissao);
jtfcomissao.setBounds(20,90,130,30);
jtfcomissao.setToolTipText("Digite a comissao");
this.add(jtfcomissao);
jlNome.setBounds(20,120,100,20);
add(jlNome);
jtfNome.setBounds(20,150,170,30);
jtfNome.setToolTipText("Digite um nome");
this.add(jtfNome);
gravar.setBounds(200,40,100,20);
gravar.addActionListener(this);
add(gravar);
limpar.setBounds(200,70,100,20);
limpar.addActionListener(this);
add(limpar);
//this.setVisible(false);
}
public void actionPerformed(ActionEvent e){
if(e.getSource()==gravar){
a.setCodatendente(jtfcodatendente.getText());
a.setComissao(jtfcomissao.getText());
a.setNome(jtfNome.getText());
jtfcodatendente.setText(a.getCodatendente());
jtfNome.setText("");
jtfcomissao.setText("");
ca.cadastrarAtendente(a);
}
if(e.getSource()==limpar){
jtfcodatendente.setText("");
jtfcomissao.setText("");
jtfNome.setText("");
}
}
}