Advertisement
Alfoli

Jogo - classe jogo

Mar 13th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.09 KB | None | 0 0
  1. import java.util.Collections;
  2. import java.util.List;
  3. import java.util.ArrayList;
  4. import javax.swing.*;
  5. import javax.swing.Icon;
  6. import javax.swing.ImageIcon;
  7. import java.awt.*;
  8. import java.awt.event.*;
  9.  
  10. public class Jogo extends JFrame{
  11.     List<Carta> morto = new ArrayList<Carta>();
  12.     Baralho monte;
  13.     Carta c;
  14.     Icon iconeFecha, iconeVazio, iconeCria1, iconeCria4, iconeEmbaralha, iconeExibe, iconeZera;
  15.     JButton btFechado, btAberto;
  16.     JButton btCria1, btCria4, btEmbaralha, btExibe, btZeratudo;
  17.        
  18.     public Jogo(){
  19.         super ("Jojo de Baralho dok peta");
  20.         setLayout(new BorderLayout()); //configura o layout do programa
  21.         iconeFecha = new ImageIcon (getClass().getResource("fechado2.png"));
  22.         iconeVazio = new ImageIcon (getClass().getResource("vazio.png"));
  23.         iconeCria1 = new ImageIcon (getClass().getResource("desconhecido.png"));
  24.         iconeCria4 = new ImageIcon (getClass().getResource("desconhecido4.png"));
  25.         iconeEmbaralha = new ImageIcon (getClass().getResource("shuffle.png"));
  26.         iconeExibe = new ImageIcon (getClass().getResource("exibe.png"));
  27.         iconeZera = new ImageIcon (getClass().getResource("zera.png"));
  28.         btFechado = new JButton (iconeVazio);
  29.         btAberto = new JButton (iconeVazio);
  30.         monte = new Baralho ();
  31.         morto.clear();
  32.         JPanel painelcentro = new JPanel(new GridLayout(1,2,5,5)); //Espaço entre as tabelas linha, coluna, espaço laterais
  33.         painelcentro.add(btFechado);
  34.         painelcentro.add(btAberto);
  35.         add(painelcentro, BorderLayout.CENTER);
  36.         JPanel painelsul = new JPanel (new FlowLayout());
  37.         btCria1 = new JButton(iconeCria1);
  38.         btCria4 = new JButton(iconeCria4);
  39.         btEmbaralha = new JButton (iconeEmbaralha);
  40.         btExibe = new JButton (iconeExibe);
  41.         btZeratudo = new JButton (iconeZera);
  42.         painelsul.add(btCria1);
  43.         painelsul.add(btCria4);
  44.         painelsul.add(btEmbaralha);
  45.         painelsul.add(btExibe);
  46.         painelsul.add(btZeratudo);
  47.         add(painelsul, BorderLayout.SOUTH);
  48.         }
  49.    
  50.    
  51.     public static void main(String[] args) {
  52.         Jogo j= new Jogo();
  53.         //j.setDefaultCloseOperations(JFrame.EXIT_ON_CLOSE);
  54.         j.setSize(1280, 720);
  55.         j.setLocation(0,0);
  56.         j.setVisible(true);
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement