SHARE
TWEET

Untitled

a guest Sep 17th, 2019 110 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package Telas;
  2.  
  3. import javax.swing.JPanel;
  4. import javax.swing.JFrame;
  5. import java.awt.Color;
  6. import javax.swing.JMenuBar;
  7. import javax.swing.JMenu;
  8. import javax.swing.JMenuItem;
  9. import java.awt.event.ActionListener;
  10. import java.awt.event.ActionEvent;
  11. import javax.swing.JOptionPane;
  12.  
  13. public class TelaInicial_primeira extends JFrame implements ActionListener{
  14.     private JMenuBar menuBar;
  15.     private JPanel painel;
  16.     private javax.swing.JMenu jMenuCadastro;
  17.     private javax.swing.JMenuItem jMenuItemCadastro;
  18.  
  19.     public TelaInicial_primeira(){
  20.  
  21.         super("Óticas HonoChik");
  22.         this.setVisible(true);
  23.         //          ( X   Y  LARGURA, ALTURA)
  24.         this.setBounds(500,500,345,385);
  25.         this.setDefaultCloseOperation(EXIT_ON_CLOSE);
  26.         this.setLocationRelativeTo(null);
  27.         this.setContentPane(getPainel());
  28.         this.repaint();
  29.         this.setJMenuBar(getMenuBaar());
  30.         addEventos();
  31.        
  32.     }
  33.  
  34.     public void addEventos(){
  35.         getJMenuItemCadastroVendedor().addActionListener(this);
  36.     }
  37.  
  38.     public JMenuItem getJMenuItemCadastroVendedor(){
  39.         if(jMenuItemCadastro == null){
  40.             jMenuItemCadastro = new JMenuItem("Escolher Vendedor");
  41.            
  42.         }
  43.         return jMenuItemCadastro;
  44.     }
  45.  
  46.     public JMenu getjMenuCadastro(){
  47.         if(jMenuCadastro == null){
  48.             jMenuCadastro = new JMenu("Cadastros");
  49.             jMenuCadastro.add(getJMenuItemCadastroVendedor());
  50.         }
  51.         return jMenuCadastro;
  52.     }
  53.  
  54.     public JPanel getPainel(){
  55.         if(painel == null){
  56.             painel =  new JPanel();
  57.             painel.setLayout(null);
  58.             painel.add(getMenuBaar());
  59.  
  60.         }
  61.         return painel;
  62.     }
  63.  
  64.     public JMenuBar getMenuBaar(){
  65.         if(menuBar == null){
  66.             menuBar = new JMenuBar();
  67.             menuBar.add(getjMenuCadastro());
  68.            
  69.         }
  70.         return menuBar;
  71.     }
  72.  
  73.     public void actionPerformed(ActionEvent e){
  74.         if(e.getSource() == getJMenuItemCadastroVendedor()){
  75.            
  76.             TelaInicial tela = new TelaInicial().setContentPane(getPainel());
  77.            
  78.            
  79.         }
  80.     }
  81.  
  82. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top