-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathJava Menu
More file actions
64 lines (50 loc) · 1.58 KB
/
Copy pathJava Menu
File metadata and controls
64 lines (50 loc) · 1.58 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
58
59
60
61
62
63
64
package trabJav;
import java.awt.Button;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
public class Menu extends Tela implements ActionListener {
private JLabel txtMenu = new JLabel("Menu");
private Button btLivros = new Button("Cadastrar ou consultar livros");
private Button btEmprestimo = new Button("Fazer emprestimos ou devoluções");
private JFrame telaMenu = new JFrame();
public void montarTela() {
this.montaFrame();
this.montaConteudo();
}
public void montaFrame() {
this.telaMenu.setSize(400,500);
this.telaMenu.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.painel.setLayout(null);
this.telaMenu.add(this.painel);
this.telaMenu.setVisible(true);
}
public void montaConteudo() {
this.painel.add(this.txtMenu);
this.txtMenu.setBounds(180, 40, 100, 30);
this.painel.add(this.btLivros);
this.btLivros.setBounds(90, 80, 220, 30);
this.btLivros.addActionListener(this);
this.painel.add(this.btEmprestimo);
this.btEmprestimo.setBounds(90, 120, 220, 30);
this.btEmprestimo.addActionListener(this);
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == this.btLivros) {
this.setProximaTela("cadastro");
} else if (e.getSource() == this.btEmprestimo) {
this.setProximaTela("emprestimo");
}
}
public void setTelaMenu(Boolean TrueFalse) {
if(TrueFalse == true) {
this.telaMenu.setVisible(true);
} else {
this.telaMenu.setVisible(false);
}
}
}