-
Notifications
You must be signed in to change notification settings - Fork 0
/
cadastrotarefas
60 lines (45 loc) · 1.59 KB
/
cadastrotarefas
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
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
public class Janela extends JFrame {
private JComboBox<String> opcoesComboBox;
private String[] opcoes = {"Alta","Baixa","Média"};
private JLabel itemSelecionadoLabel;
private JButton salvar;
private JButton cancelar;
public Janela(){
setTitle("Janela de Tarefas");
setSize(400,400);
setDefaultCloseOperation(EXIT_ON_CLOSE);
configurarJanela();
setVisible(true);
}
private void configurarJanela(){
JPanel panel = new JPanel();
opcoesComboBox = new JComboBox<>(opcoes);
opcoesComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
itemSelecionadoLabel.setText((String) opcoesComboBox.getSelectedItem());
}
});
itemSelecionadoLabel = new JLabel();
JTextField campoTextField = new JTextField(10);
salvar = new JButton( "salvar" );
cancelar = new JButton( "cancelar" );
JCheckBox CheckBox = new JCheckBox("Concluído");
CheckBox.setSelected(true);
panel.add(new JLabel("Tarefa"));
panel.add(campoTextField);
panel.add(itemSelecionadoLabel);
panel.add(new JLabel("Prioridade"));
panel.add(opcoesComboBox);
panel.add(itemSelecionadoLabel);
panel.add(CheckBox);
panel.add( cancelar );
panel.add( salvar );
add(panel);
}
}