Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.BorderLayout;
- import java.awt.CardLayout;
- import javax.swing.ImageIcon;
- import javax.swing.JLabel;
- import javax.swing.JOptionPane;
- import javax.swing.JPanel;
- public class Controlador {
- private TelaPCs Guia;
- private TelaInfoMais infomais;
- private TelaCadastroPC telaCadastroPC;
- private TelaPrincipal telaPrincipal;
- private JLabel Logo;
- private JPanel telaLimpa;
- private CardLayout cardLayout;
- public Controlador(TelaPrincipal parent, CardLayout cardLayout){
- this.cardLayout = cardLayout;
- telaPrincipal = parent;
- telaPrincipal.setLayout(cardLayout);
- telaLimpa = new JPanel();
- telaPrincipal.add(telaLimpa, "telaLimpa");
- Logo = new JLabel(new ImageIcon("src/Logo.png"));
- telaLimpa.setLayout(new BorderLayout());
- telaLimpa.add(Logo, BorderLayout.NORTH);
- telaCadastroPC = new TelaCadastroPC(this);
- telaPrincipal.add(telaCadastroPC, "telaCadastroPC");
- Guia = new TelaPCs(this);
- telaPrincipal.add(Guia, "Guia");
- cardLayout.show(telaPrincipal.getContentPane(), "telaLimpa");
- }
- public void MostrarTelaLimpa(){
- cardLayout.show(telaPrincipal.getContentPane(), "telaLimpa");
- }
- public void MostrarTelaCadastroPC(){
- cardLayout.show(telaPrincipal.getContentPane(), "telaCadastroPC");
- }
- public void mostrarGuia(){
- cardLayout.show(telaPrincipal.getContentPane(), "Guia");
- }
- public void sair(){
- int opt = JOptionPane.showConfirmDialog(telaPrincipal, "Deseja sair?", "Sair", JOptionPane.YES_NO_OPTION);
- if(opt == JOptionPane.YES_OPTION){
- System.exit(0);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement