-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTela.java
More file actions
57 lines (42 loc) · 1.36 KB
/
Copy pathTela.java
File metadata and controls
57 lines (42 loc) · 1.36 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
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.*;
public class Tela extends JFrame {
// Atributos
public static final String titulo = "TELA INICIAL";
private CardLayout cardLayout;
private JPanel cardPainel;
private TelaInicial telaInicial;
private TelaCadastro telaCadastro;
// Construtor
public Tela(){
super(titulo);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setResizable(false);
this.cardLayout = new CardLayout();
cardPainel = new JPanel();
cardPainel.setLayout(cardLayout);
add(cardPainel);
criarCards();
}
// Métodos
public void mostrar(){
pack();
setLocationRelativeTo(null);
setVisible(true);
}
private void criarCards(){
telaInicial = new TelaInicial(this);
cardPainel.add(telaInicial, TelaInicial.class.getName());
telaCadastro = new TelaCadastro(this);
cardPainel.add(telaCadastro, TelaCadastro.class.getName());
}
public void mostrarTelaCadastro(Aluno aluno){
telaCadastro.setCadastro(aluno);
cardLayout.show(cardPainel, TelaCadastro.class.getName());
}
public void mostrarTelaInicial(){
telaInicial.recarregar();
cardLayout.show(cardPainel, TelaInicial.class.getName());
}
} // Fim da classe TelaPrincipal