Baixe o app para aproveitar ainda mais
Prévia do material em texto
TRABALHO AV1 PROGRAMAÇÃO II TelaLogin.java /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package TelasTrabalho; import java.awt.GridLayout; import java.awt.FlowLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.JLabel; /** * * @author Rebeca */ public class TelaLogin extends JFrame{ private JTextField ASenha , ALogin; private JLabel Login,Senha; private JPanel cLogin , cSenha ,cBotoes; private JButton Entrar , Cancelar , Cadastrar; public TelaLogin(){ super("Tela de Login"); Login = new JLabel("Login:"); ALogin = new JTextField("",20); Senha = new JLabel("Senha:"); ASenha = new JTextField("",20); cLogin = new JPanel(new FlowLayout()); cSenha = new JPanel(new FlowLayout()); Entrar = new JButton(" Entrar "); Cancelar = new JButton ("Cancelar"); Cadastrar = new JButton("Cadastre-se"); cBotoes = new JPanel (new FlowLayout()); getContentPane().setLayout(new GridLayout(4,3)); } public void init(){ setSize (400, 300); setLocationRelativeTo(null); cLogin.add(Login); cLogin.add(ALogin); cSenha.add(Senha); cSenha.add(ASenha); cBotoes.add(Entrar); cBotoes.add(Cadastrar); cBotoes.add(Cancelar); getContentPane().add(cLogin); getContentPane().add(cSenha); getContentPane().add(cBotoes); setDefaultCloseOperation (EXIT_ON_CLOSE); setVisible (true); } /** * @param args the command line arguments */ public static void main(String[] args) { new TelaLogin().init(); } } TelaCadastro.java package TelasTrabalho; /** * * @author Rebeca */ import java.awt.FlowLayout; import java.awt.GridLayout; import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTextField; import javax.swing.JToggleButton; import javax.swing.JComboBox; public class TelaCadastro extends JFrame { private JButton Cadastrar, Limpar , Fechar ; private JLabel MSexo , Nome ,Endereco ,ECivil; private JRadioButton masculino, feminino; private JToggleButton acesso; private JPanel a1, a2, a3, a4,a5; private JTextField CNome, CEndereco; private JComboBox<String> CBECivil ; public TelaCadastro () { super("Tela de Cadastro"); Nome = new JLabel (" Nome: "); CNome = new JTextField(20); Endereco = new JLabel ("Endereço:"); CEndereco = new JTextField(20); ECivil = new JLabel ("Estado Civil:"); MSexo = new JLabel ("Sexo:"); CBECivil = new JComboBox<>(); Cadastrar = new JButton("Cadastrar"); Limpar = new JButton("Limpar"); Fechar = new JButton("Fechar"); masculino = new JRadioButton("Masculino"); feminino = new JRadioButton("Feminino"); a1 = new JPanel(new FlowLayout()); a2 = new JPanel(new FlowLayout()); a3 = new JPanel(); a4 = new JPanel(); a5 = new JPanel(); getContentPane().setLayout( new GridLayout(5, 1)); } public void init () { setSize(400, 300); setLocationRelativeTo(null); ButtonGroup bg = new ButtonGroup(); CBECivil.setModel(new javax.swing.DefaultComboBoxModel<> (new String[] {"Solteiro", "Casado", "Divorciado"})); bg.add(masculino); bg.add(feminino); a1.add(Nome); a1.add(CNome); a2.add(Endereco); a2.add(CEndereco); a3.add(MSexo); a3.add(masculino); a3.add(feminino); a4.add(ECivil); a4.add(CBECivil); a5.add(Cadastrar); a5.add(Limpar); a5.add(Fechar); getContentPane().add(a1); getContentPane().add(a2); getContentPane().add(a3); getContentPane().add(a4); getContentPane().add(a5); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); } public static void main(String[] args) { new TelaCadastro().init(); } } TelaMenuPrincipal.java /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package TelasTrabalho; import java.awt.BorderLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; /** * * @author Rebeca */ public class TelaMenuPrincipal extends JFrame { private JButton Novo,Cadastro,Salvar,Fechar; private JPanel ATopo ; public TelaMenuPrincipal(){ super("Tela principal"); Novo = new JButton("Novo"); Cadastro = new JButton("Cadastar"); Salvar = new JButton("Salvar"); Fechar = new JButton("Fechar"); ATopo = new JPanel(); getContentPane().setLayout(new BorderLayout()); } public void init(){ setSize (400, 300); setLocationRelativeTo(null); ATopo.add(Novo); ATopo.add(Cadastro); ATopo.add(Salvar); ATopo.add(Fechar); getContentPane().add(ATopo,BorderLayout.NORTH); setDefaultCloseOperation (EXIT_ON_CLOSE); setVisible (true); } public static void main(String[] args) { new TelaMenuPrincipal().init(); } }
Compartilhar