Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Telas;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- import javax.swing.JButton;
- import javax.swing.JTextField;
- import javax.swing.JLabel;
- import java.awt.Color;
- import javax.swing.border.LineBorder;
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
- import javax.swing.JOptionPane;
- public class TelaInicial extends JPanel implements ActionListener{
- private JPanel painel;
- private JButton botao;
- private JButton botao1;
- private JButton botao2;
- private JTextField nome;
- private JLabel label_nome;
- private JLabel bem_vindo;
- public TelaInicial(){
- //super("Óticas HonoChik");
- //this.setVisible(true);
- //// ( X Y LARGURA, ALTURA)
- //this.setBounds(500,500,345,385);
- //this.setDefaultCloseOperation(EXIT_ON_CLOSE);
- //this.setLocationRelativeTo(null);
- this.setContentPane(getPainel());
- //this.repaint();
- addEventos();
- }
- public void addEventos(){
- getBotao().addActionListener(this);
- getBotao1().addActionListener(this);
- getBotao2().addActionListener(this);
- }
- public JPanel getPainel(){
- if(painel==null){
- painel = new JPanel();
- painel.setLayout(null);
- painel.add(getBotao());
- painel.add(getBotao1());
- painel.add(getBotao2());
- painel.add(getJLabelBemVindo());
- painel.setBackground(new Color(61, 21, 30));
- painel.repaint();
- }
- return painel;
- }
- public JButton getBotao(){
- if(botao == null){
- botao = new JButton();
- botao.setBounds(50,120,100,50);
- botao.setForeground(new Color(255,255,255));
- botao.setBackground(new Color(126, 43, 51));
- botao.setText("Evelin");
- botao.setBorder(new LineBorder(new Color(126, 43, 51), 2, true));
- }
- return botao;
- }
- public JButton getBotao1(){
- if(botao1 ==null){
- botao1 = new JButton();
- botao1.setBounds(50,190,100,50);
- botao1.setForeground(new Color(255,255,255));
- botao1.setBackground(new Color(126, 43, 51));
- botao1.setText("Josimar");
- botao1.setBorder(new LineBorder(new Color(126, 43, 51), 2, true));
- }
- return botao1;
- }
- public JButton getBotao2(){
- if(botao2 ==null){
- botao2 = new JButton();
- botao2.setBounds(50,260,100,50);
- botao2.setForeground(new Color(255,255,255));
- botao2.setBackground(new Color(126, 43, 51));
- botao2.setText("Diego");
- botao2.setBorder(new LineBorder(new Color(126, 43, 51), 2, true));
- }
- return botao2;
- }
- public JLabel getJLabelBemVindo(){
- if(bem_vindo == null){
- bem_vindo = new JLabel("Bem vindo à Óticas HonoChick");
- bem_vindo.setForeground(new Color(255,255,255));
- bem_vindo.setBounds(70,0,200,100);
- }
- return bem_vindo;
- }
- public void actionPerformed(ActionEvent e){
- if(e.getSource() == getBotao()){
- JOptionPane.showMessageDialog(null,"Vendedora Evelin");
- }
- if(e.getSource() == getBotao1()){
- JOptionPane.showMessageDialog(null,"Vendedora Josimar");
- }
- if(e.getSource() == getBotao2()){
- JOptionPane.showMessageDialog(null,"Vendedora Diego");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement