Guest User

Untitled

a guest
May 17th, 2018
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.55 KB | None | 0 0
  1. import java.awt.*;
  2. import java.awt.event.*;
  3. import javax.swing.*;
  4.  
  5. public class Principal extends JFrame{
  6.  
  7.       private JButton entrar;
  8.       private JLabel auxilio;
  9.       private ImageIcon loubackCassino;
  10.       private static Principal frame;
  11.      
  12.      
  13.       public Principal(){
  14.           inicializarComponentes();
  15.           definirEventos();
  16.       }
  17.    
  18.      
  19.      
  20.       private void inicializarComponentes(){
  21.           setTitle("Louback's Cassino");
  22.           setBounds(0,0,500,500);
  23.           setLayout(null);
  24.           Image image = Toolkit.getDefaultToolkit().getImage("INICIAL.JPG");
  25.           loubackCassino = new ImageIcon(image);
  26.           setBackground(new Color(100, 220, 100));
  27.           auxilio = new JLabel(loubackCassino);
  28.           entrar = new JButton("Entrar no Cassino");
  29.           entrar.setBounds(150,400,200,20);
  30.           add(auxilio);
  31.           add(entrar);
  32.          
  33.       }
  34.      
  35.       private void definirEventos(){
  36.          
  37.           entrar.addActionListener(new ActionListener(){
  38.               public void actionPerformed(ActionEvent e){
  39.              
  40.                   // INICIA NOVA CLASSE
  41.                  
  42.               }
  43.           });
  44.          
  45.       }
  46.    
  47.     public static void main(String[] args) {
  48.         SwingUtilities.invokeLater(new Runnable() {
  49.             public void run() {
  50.                 frame = new Principal();
  51.                 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  52.                 Dimension tela = Toolkit.getDefaultToolkit().getScreenSize();
  53.                 frame.setLocation((tela.width - frame.getSize().width) / 2,
  54.                         (tela.height - frame.getSize().height) / 2);
  55.                 frame.setVisible(true);
  56.             }
  57.         });
  58.     }
  59.  
  60. }
Add Comment
Please, Sign In to add comment