Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- public class Principal extends JFrame{
- private JButton entrar;
- private JLabel auxilio;
- private ImageIcon loubackCassino;
- private static Principal frame;
- public Principal(){
- inicializarComponentes();
- definirEventos();
- }
- private void inicializarComponentes(){
- setTitle("Louback's Cassino");
- setBounds(0,0,500,500);
- setLayout(null);
- Image image = Toolkit.getDefaultToolkit().getImage("INICIAL.JPG");
- loubackCassino = new ImageIcon(image);
- setBackground(new Color(100, 220, 100));
- auxilio = new JLabel(loubackCassino);
- entrar = new JButton("Entrar no Cassino");
- entrar.setBounds(150,400,200,20);
- add(auxilio);
- add(entrar);
- }
- private void definirEventos(){
- entrar.addActionListener(new ActionListener(){
- public void actionPerformed(ActionEvent e){
- // INICIA NOVA CLASSE
- }
- });
- }
- public static void main(String[] args) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- frame = new Principal();
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- Dimension tela = Toolkit.getDefaultToolkit().getScreenSize();
- frame.setLocation((tela.width - frame.getSize().width) / 2,
- (tela.height - frame.getSize().height) / 2);
- frame.setVisible(true);
- }
- });
- }
- }
Add Comment
Please, Sign In to add comment