Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import javax.swing.*;
- public class Exercicio extends JFrame
- {
- private static final long serialVersionUID = 1L;
- JLabel lb_titulo, lb_autor,_lb_logo,_lb_fruta;
- JButton bt_cadastro,bt_sair;
- ImageIcon imagem_logo;
- JComboBox jcb_familia;
- JList jl_frutas;
- JTextField tf_nome;
- JLabel lb_logo;
- //1
- static JRadioButton jrb_masc;
- static JRadioButton jrb_fem;
- //2
- static ButtonGroup grupo_sexo;
- //static JPasswordField tf_senha;
- public Exercicio()
- {
- setTitle("Aprendendo Orientacao a Objetos");
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setResizable(false); }
- public static void main(String[] args)
- {
- JFrame obj = new JFrame();
- JLabel lb_titulo = new JLabel();
- obj.setResizable(true);
- obj.setTitle("Aprendendo Orientacao a Objetos");
- ImageIcon imagem_logo = new ImageIcon("C:/Users/...");
- obj.getContentPane().setBackground(Color.gray);
- JButton bt_cadastro = new JButton("Casdastro");
- JButton bt_sair = new JButton("Sair");
- lb_titulo = new JLabel("AULA JAVA");
- JLabel lb_autor = new JLabel("Capitao");
- JLabel lb_logo = new JLabel(imagem_logo);
- //1
- jrb_masc = new JRadioButton("Masculino");
- jrb_fem = new JRadioButton("Feminino");
- //2
- grupo_sexo = new ButtonGroup();
- grupo_sexo.add(jrb_masc);
- grupo_sexo.add(jrb_fem);
- String frutas[] = {"Abacaxi", "Uva", "Manga", "Goiaba"};
- JList jl_frutas = new JList(frutas);
- JTextField tf_nome = new JTextField(10);
- //4
- //JPasswordField tf_senha = new JPasswordField();
- //tf_senha.setEchoChar('*');
- JComboBox jcb_familia = new JComboBox();
- obj.getContentPane().setLayout(null);
- obj.setSize(600,600);
- obj.setLocation(70,70);
- obj.getContentPane().add("North",lb_titulo);
- obj.getContentPane().add("South",lb_autor);
- obj.getContentPane().add("West",bt_cadastro);
- obj.getContentPane().add("East",bt_sair);
- obj.getContentPane().add("North",tf_nome);
- obj.getContentPane().add("Center",lb_logo);
- //1
- obj.getContentPane().add(jrb_masc);
- obj.getContentPane().add(jrb_fem);
- //obj.getContentPane().add(grupo_sexo);
- //4
- //obj.getContentPane().add(tf_senha);
- lb_titulo.setBounds(250,10,700,40);
- lb_logo.setBounds(60,50,500,200);
- bt_cadastro.setBounds(3,50,150,50);
- bt_sair.setBounds(3,110,150,50);
- lb_autor.setBounds(10,0,200,70);
- tf_nome.setBounds(0,230,100,20);
- jcb_familia.setBounds(3,170,150,30);
- //1
- jrb_masc.setBounds(0,290,100,25);
- jrb_fem.setBounds(0,340,100,25);
- //2
- //grupo_sexo.setBounds(600,50,100,50);
- //4
- //tf_senha.setBounds(0,260,100,20);
- obj.getContentPane().add("North",tf_nome);
- obj.getContentPane().add("South",jcb_familia);
- jcb_familia.addItem("ANA");
- jcb_familia.addItem("PAULA");
- jcb_familia.addItem("JOAO");
- jcb_familia.addItem("ANDRE");
- //obj.pack();
- obj.setVisible(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement