poo

Upload: luis-alberto-acosta-perez

Post on 10-Jan-2016

217 views

Category:

Documents


1 download

DESCRIPTION

Documentacion

TRANSCRIPT

Universidad Autnoma de Nuevo LenFacultad Ingeniera Mecnica y ElctricaASESOR: APRENDE HORA: SABATINOS SALON: 42FECHA DE ENTREGA:

APRENDEOBJETIVO

El proyecto o juego est diseado con la finalidad de estimular el aprendizaje de los nios de edades entre 6 a 12 aos, ya que buscamos despertar las habilidades de memorizacin y lingsticas del usuario, el juego consta de un Memorama, el cual tiene dos idiomas el espaol y el ingls.JUSTIFICACION

El proyecto fue realizado con fines educativos, para que el usuario pueda desarrollar habilidades y retenga la informacin ms rpido. Se pretende ayudar a las personas a que retengan la informacin ms rpido ya que trata de un memorama el cual va aumentando su dificultad para el usuario y tiene dos idiomas el espaol y el ingls. El juego consta de ciertas imgenes revueltas con un tiempo y puntuacin con el fin de entretener al usuario ya que cuenta tu puntuacin y la comparas con la de otros usuariosREQUERIMIENTOS

Tener instalado un programa denominado java ya que el proyecto est diseado en Netbeans y se necesita la plataforma de java para poder utilizar el juego Elaborar el juego que sea fcil de usar para el usuario DIAGRAMA

DICCIONARIO DE DATOS

TABLA: CLIENTEORDENOBJETOETIQUETADESCT.DFORMATOLLAVE

10NO_CLINO:INT9999SI

ESPAOL ESTRUCTURADO

Este mtodo es para tratar de evitar los problemas de ambigedad del lenguaje al establecer condiciones y acciones, tanto en procedimientos como en decisiones. Este mtodo no hace uso de rboles o tablas; en su lugar utiliza declaraciones para describir el proceso. El mtodo no muestra las reglas de decisin-, las declara. Sin embargo, este mtodo tambin le permite hacer una lista de todos los pasos en el orden en que se llevan a cabo, como lo muestran los ejemplos de esta seccin. Para ello no se utilizan smbolos y formatos especiales, caractersticas de los rboles y tablas de decisin que para algunos resultan incmodos. Adems, es posible describir con rapidez los procedimientos en su totalidad ya que para ello se emplean declaraciones muy similares al espaol.

El diseo de software es un proceso mediante el que se traducen los requisitos en una representacin del software. En el diseo se realizan dos pasos. El diseo preliminar se centra en la transformacin de los requisitos en los datos y arquitectura del software. El diseo detallado se ocupa del refinamiento de la representacin arquitectnica que lleva a una estructura de datos detallada y a las representaciones algortmicas del software.

SE PUEDE INTERPRETAR DE LA SIGUIENTE MANERA.

INTERFAZ

INTERFAZ ENTRADA

En esta interfaz el usuario empieza a jugar con el memoraba ya que tiene varios niveles imgenes e idiomas.

INTERFAZ DE SALIDA

En esta interfaz, el usuario despues de haber concluido el juego, se le mostrara una ventana con su puntuacion y continuara con los siguientes niveles hasta terminar el juego.

INTERFAZ MIXTA

En esta interfaz el usuario comienza a jugar descubriendo las imgenes que hay debajo haciendo un click sobre la misma.

Estas son las imgenes que se descubren al dar un click, la imagen esta en dos idiomas espaol e ingls. BASE DE DATOSLogicaJuego:package auxiliar;import java.util.Random;public class LogicaJuego { public int[] getCardNumbers() { int[] numbers = new int[16]; int count = 0; while(count < 16) { Random r = new Random(); int na = r.nextInt(8) + 1; int nvr = 0; for (int i = 0; i < 16; i++) { if(numbers[i] == na) { nvr++; } } if(nvr < 2) { numbers[count] = na; count++; } }return numbers; } }

NewMain:package auxiliar;import java.util.Random;public class NewMain { public static void main(String[] args) { // TODO code application logic here int[] numbers = new int[16]; int count = 0; while(count < 16) { Random r = new Random(); int na = r.nextInt(8) + 1; int nvr = 0; for (int i = 0; i < 16; i++) { if(numbers[i] == na) { nvr++; } } if(nvr < 2) { numbers[count] = na; count++; } } for (int i = 0; i < 16; i++) { System.out.print(numbers[i]+" "); } }}VFondo:package gui;

import java.awt.Graphics;import java.awt.Image;import javax.swing.ImageIcon;public class VFondo extends javax.swing.JPanel { public VFondo(int w, int h) { initComponents(); setSize(w, h); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); Image im = new ImageIcon(getClass().getResource("../imagenes/fondo.JPG")).getImage(); g.drawImage(im, 0, 0, getWidth(), getHeight(), null); setOpaque(false); setVisible(true); }

Usuario:package gui;import javax.swing.JOptionPane;public class usuario extends javax.swing.JFrame { public usuario() { initComponents(); } @SuppressWarnings("unchecked") private void initComponents() { jLabel1 = new javax.swing.JLabel(); txtUsuario = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); jpassClave = new javax.swing.JPasswordField(); jButton1 = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setBackground(new java.awt.Color(0, 255, 255)); setPreferredSize(new java.awt.Dimension(382, 498)); jLabel1.setText("Nombre"); txtUsuario.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtUsuarioActionPerformed(evt); } }); jLabel2.setText("Clave"); jButton1.setText("INICIAR"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(64, 64, 64) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jpassClave, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 206, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(101, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(72, 72, 72) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txtUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jpassClave, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(61, 61, 61) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(126, Short.MAX_VALUE)) ); pack(); }// private void txtUsuarioActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: }

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { char clave[]=jpassClave.getPassword();String clavedef=new String(clave);if (txtUsuario.getText().equals("usuario") && clavedef.equals("1234")){ this.dispose(); JOptionPane.showMessageDialog(null, "Bienvenido\n" + "Has ingresado satisfactoriamente al sistema", "Mensaje de bienvenida", JOptionPane.INFORMATION_MESSAGE); Menu obj=new Menu(); obj.setVisible(true); dispose(); }else { JOptionPane.showMessageDialog(null, "Acceso denegado:\n" + "Por favor ingrese un usuario y/o contrasea correctos", "Acceso denegado", JOptionPane.ERROR_MESSAGE); } } public static void main(String args[]) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(usuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(usuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(usuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(usuario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new usuario().setVisible(true); } }); } private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JPasswordField jpassClave; private javax.swing.JTextField txtUsuario; }

Formulario1:package gui;class Formulario1 { void setVisible(boolean b) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }

Menu:package gui;public class Menu extends javax.swing.JFrame { public Menu() { initComponents(); } @SuppressWarnings("unchecked") private void initComponents() { jButton1 = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setBackground(new java.awt.Color(153, 255, 204)); jButton1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButton1.setForeground(new java.awt.Color(0, 153, 153)); jButton1.setText("COMENZAR"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel1.setForeground(new java.awt.Color(0, 153, 153)); jLabel1.setText("Bienvenido a APRENDE!"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap(84, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(108, 108, 108)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(jLabel1) .addGap(78, 78, 78)))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(109, 109, 109) .addComponent(jLabel1) .addGap(80, 80, 80) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(203, Short.MAX_VALUE)) ); pack(); }// private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { PlayGame obj=new PlayGame(); obj.setVisible(true); dispose(); } public static void main(String args[]) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Menu().setVisible(true); } }); } private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1;}PlayGame:package gui;

import auxiliar.LogicaJuego;import java.awt.BorderLayout;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JOptionPane;

public class PlayGame extends javax.swing.JFrame {

private VFondo fondo; private LogicaJuego log = new LogicaJuego(); private boolean caraUp = false; private ImageIcon im1; private ImageIcon im2; private JButton[] pbtn = new JButton[2]; private boolean primerc = false; private int puntaje = 0; public PlayGame() { initComponents(); fondo = new VFondo(getWidth(), getHeight()); add(fondo, BorderLayout.CENTER); setCards(); } private void setCards() { int[] numbers = log.getCardNumbers(); btnC1.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes/c"+numbers[0]+".png"))); btnC2.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes/c"+numbers[1]+".png"))); btnC3.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes/c"+numbers[2]+".png"))); btnC4.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes/c"+numbers[3]+".png"))); btnC5.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes/c"+numbers[4]+".png"))); btnC6.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes/c"+numbers[5]+".png"))); btnC7.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes/c"+numbers[6]+".png"))); btnC8.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes/c"+numbers[7]+".png"))); btnC9.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes/c"+numbers[8]+".png"))); btnC10.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes/c"+numbers[9]+".png"))); btnC11.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes/c"+numbers[10]+".png"))); btnC12.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes/c"+numbers[11]+".png"))); btnC13.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes/c"+numbers[12]+".png"))); btnC14.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes/c"+numbers[13]+".png"))); btnC15.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes/c"+numbers[14]+".png"))); btnC16.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes/c"+numbers[15]+".png"))); } private void btnEnabled(JButton btn) { if(!caraUp) { btn.setEnabled(false); im1 = (ImageIcon) btn.getDisabledIcon(); pbtn[0] = btn; caraUp = true; primerc = false; } else { btn.setEnabled(false); im2 = (ImageIcon) btn.getDisabledIcon(); pbtn[1] = btn; primerc = true; puntaje += 20; pregwin(); } } private void compare() { if(caraUp && primerc) { if(im1.getDescription().compareTo(im2.getDescription()) != 0) { pbtn[0].setEnabled(true); pbtn[1].setEnabled(true); if(puntaje > 10 ) puntaje -= 10; } caraUp = false; } } private void reiniciar() { btnC1.setEnabled(true); btnC2.setEnabled(true); btnC3.setEnabled(true); btnC4.setEnabled(true); btnC5.setEnabled(true); btnC6.setEnabled(true); btnC7.setEnabled(true); btnC8.setEnabled(true); btnC9.setEnabled(true); btnC10.setEnabled(true); btnC11.setEnabled(true); btnC12.setEnabled(true); btnC13.setEnabled(true); btnC14.setEnabled(true); btnC15.setEnabled(true); btnC16.setEnabled(true); primerc = false; caraUp = false; puntaje = 0; } private void pregwin() { if(!btnC1.isEnabled() && !btnC2.isEnabled() && !btnC3.isEnabled() && !btnC4.isEnabled() && !btnC5.isEnabled() && !btnC6.isEnabled() && !btnC7.isEnabled() && !btnC8.isEnabled() && !btnC9.isEnabled() && !btnC10.isEnabled() && !btnC11.isEnabled() && !btnC12.isEnabled() && !btnC13.isEnabled() && !btnC14.isEnabled() && !btnC15.isEnabled() && !btnC16.isEnabled()) { JOptionPane.showMessageDialog(this, "Felicidades, usted ha ganado. Su puntaje es: "+puntaje, "Win!!", JOptionPane.INFORMATION_MESSAGE); } } @SuppressWarnings("unchecked") // private void initComponents() {

jLabel1 = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); btnC1 = new javax.swing.JButton(); btnC2 = new javax.swing.JButton(); btnC3 = new javax.swing.JButton(); btnC4 = new javax.swing.JButton(); btnC8 = new javax.swing.JButton(); btnC7 = new javax.swing.JButton(); btnC6 = new javax.swing.JButton(); btnC5 = new javax.swing.JButton(); btnC12 = new javax.swing.JButton(); btnC11 = new javax.swing.JButton(); btnC10 = new javax.swing.JButton(); btnC9 = new javax.swing.JButton(); btnC16 = new javax.swing.JButton(); btnC15 = new javax.swing.JButton(); btnC14 = new javax.swing.JButton(); btnC13 = new javax.swing.JButton(); btnReiniciar = new javax.swing.JButton(); jButton1 = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Juego Dos Caras");

jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel1.setForeground(new java.awt.Color(102, 102, 102)); jLabel1.setText("Colores");

jPanel1.setBackground(new java.awt.Color(193, 127, 59));

btnC1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC1.setBorder(null); btnC1.setBorderPainted(false); btnC1.setContentAreaFilled(false); btnC1.setFocusable(false); btnC1.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC1MouseExited(evt); } }); btnC1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC1ActionPerformed(evt); } });

btnC2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC2.setBorder(null); btnC2.setBorderPainted(false); btnC2.setContentAreaFilled(false); btnC2.setFocusable(false); btnC2.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC2.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC2MouseExited(evt); } }); btnC2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC2ActionPerformed(evt); } });

btnC3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC3.setBorder(null); btnC3.setBorderPainted(false); btnC3.setContentAreaFilled(false); btnC3.setFocusable(false); btnC3.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC3.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC3MouseExited(evt); } }); btnC3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC3ActionPerformed(evt); } });

btnC4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC4.setBorder(null); btnC4.setBorderPainted(false); btnC4.setContentAreaFilled(false); btnC4.setFocusable(false); btnC4.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC4.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC4MouseExited(evt); } }); btnC4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC4ActionPerformed(evt); } });

btnC8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC8.setBorder(null); btnC8.setBorderPainted(false); btnC8.setContentAreaFilled(false); btnC8.setFocusable(false); btnC8.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC8.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC8MouseExited(evt); } }); btnC8.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC8ActionPerformed(evt); } });

btnC7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC7.setBorder(null); btnC7.setBorderPainted(false); btnC7.setContentAreaFilled(false); btnC7.setFocusable(false); btnC7.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC7.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC7MouseExited(evt); } }); btnC7.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC7ActionPerformed(evt); } });

btnC6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC6.setBorder(null); btnC6.setBorderPainted(false); btnC6.setContentAreaFilled(false); btnC6.setFocusable(false); btnC6.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC6.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC6MouseExited(evt); } }); btnC6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC6ActionPerformed(evt); } });

btnC5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC5.setBorder(null); btnC5.setBorderPainted(false); btnC5.setContentAreaFilled(false); btnC5.setFocusable(false); btnC5.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC5.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC5MouseExited(evt); } }); btnC5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC5ActionPerformed(evt); } });

btnC12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC12.setBorder(null); btnC12.setBorderPainted(false); btnC12.setContentAreaFilled(false); btnC12.setFocusable(false); btnC12.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC12.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC12MouseExited(evt); } }); btnC12.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC12ActionPerformed(evt); } });

btnC11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC11.setBorder(null); btnC11.setBorderPainted(false); btnC11.setContentAreaFilled(false); btnC11.setFocusable(false); btnC11.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC11.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC11MouseExited(evt); } }); btnC11.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC11ActionPerformed(evt); } });

btnC10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC10.setBorder(null); btnC10.setBorderPainted(false); btnC10.setContentAreaFilled(false); btnC10.setFocusable(false); btnC10.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC10.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC10MouseExited(evt); } }); btnC10.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC10ActionPerformed(evt); } });

btnC9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC9.setBorder(null); btnC9.setBorderPainted(false); btnC9.setContentAreaFilled(false); btnC9.setFocusable(false); btnC9.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC9.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC9MouseExited(evt); } }); btnC9.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC9ActionPerformed(evt); } });

btnC16.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC16.setBorder(null); btnC16.setBorderPainted(false); btnC16.setContentAreaFilled(false); btnC16.setFocusable(false); btnC16.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC16.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC16MouseExited(evt); } }); btnC16.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC16ActionPerformed(evt); } });

btnC15.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC15.setBorder(null); btnC15.setBorderPainted(false); btnC15.setContentAreaFilled(false); btnC15.setFocusable(false); btnC15.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC15.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC15MouseExited(evt); } }); btnC15.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC15ActionPerformed(evt); } });

btnC14.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC14.setBorder(null); btnC14.setBorderPainted(false); btnC14.setContentAreaFilled(false); btnC14.setFocusable(false); btnC14.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC14.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC14MouseExited(evt); } }); btnC14.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC14ActionPerformed(evt); } });

btnC13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC13.setBorder(null); btnC13.setBorderPainted(false); btnC13.setContentAreaFilled(false); btnC13.setFocusable(false); btnC13.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC13.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC13MouseExited(evt); } }); btnC13.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC13ActionPerformed(evt); } });

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(btnC1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnC2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnC3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnC4)) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(btnC5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnC6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnC7) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnC8)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(btnC9) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnC10) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnC11) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnC12)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(btnC13) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnC14) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnC15) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnC16))) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btnC4) .addComponent(btnC2) .addComponent(btnC1) .addComponent(btnC3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btnC6) .addComponent(btnC5) .addComponent(btnC7) .addComponent(btnC8)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btnC9) .addComponent(btnC10) .addComponent(btnC11) .addComponent(btnC12)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btnC13) .addComponent(btnC14) .addComponent(btnC15) .addComponent(btnC16))) );

btnReiniciar.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N btnReiniciar.setForeground(new java.awt.Color(255, 0, 0)); btnReiniciar.setText("Reiniciar"); btnReiniciar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnReiniciarActionPerformed(evt); } });

jButton1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButton1.setForeground(new java.awt.Color(0, 204, 0)); jButton1.setText("Siguiente"); jButton1.setPreferredSize(new java.awt.Dimension(83, 23)); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } });

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(12, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addGap(41, 41, 41) .addComponent(btnReiniciar) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel1) .addGap(33, 33, 33) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(34, 34, 34)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnReiniciar) .addComponent(jLabel1) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) );

setSize(new java.awt.Dimension(400, 538)); setLocationRelativeTo(null); }//

private void btnReiniciarActionPerformed(java.awt.event.ActionEvent evt) { reiniciar(); }

private void btnC13ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC13); }

private void btnC13MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC14ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC14); }

private void btnC14MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC15ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC15); }

private void btnC15MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC16ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC16); }

private void btnC16MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC9ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC9); }

private void btnC9MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC10ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC10); }

private void btnC10MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC11ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC11); }

private void btnC11MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC12ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC12); }

private void btnC12MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC5ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC5); }

private void btnC5MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC6ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC6); }

private void btnC6MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC7ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC7); }

private void btnC7MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC8ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC8); }

private void btnC8MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC4ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC4); }

private void btnC4MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC3ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC3); }

private void btnC3MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC2ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC2); }

private void btnC2MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC1ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC1); }

private void btnC1MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { PlayGame_1 obj=new PlayGame_1(); obj.setVisible(true); dispose(); }

public static void main(String args[]) { /* Set the Nimbus look and feel */ // /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(PlayGame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(PlayGame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(PlayGame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(PlayGame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //

/* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new PlayGame().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton btnC1; private javax.swing.JButton btnC10; private javax.swing.JButton btnC11; private javax.swing.JButton btnC12; private javax.swing.JButton btnC13; private javax.swing.JButton btnC14; private javax.swing.JButton btnC15; private javax.swing.JButton btnC16; private javax.swing.JButton btnC2; private javax.swing.JButton btnC3; private javax.swing.JButton btnC4; private javax.swing.JButton btnC5; private javax.swing.JButton btnC6; private javax.swing.JButton btnC7; private javax.swing.JButton btnC8; private javax.swing.JButton btnC9; private javax.swing.JButton btnReiniciar; private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1; private javax.swing.JPanel jPanel1; // End of variables declaration }

PlayGame_1:package gui;

import auxiliar.LogicaJuego;import java.awt.BorderLayout;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JOptionPane;public class PlayGame_1 extends javax.swing.JFrame {

private VFondo fondo; private LogicaJuego log = new LogicaJuego(); private boolean caraUp = false; private ImageIcon im1; private ImageIcon im2; private JButton[] pbtn = new JButton[2]; private boolean primerc = false; private int puntaje = 0; public PlayGame_1() { initComponents(); fondo = new VFondo(getWidth(), getHeight()); add(fondo, BorderLayout.CENTER); setCards(); } private void setCards() { int[] numbers = log.getCardNumbers(); btnC1.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes1/c"+numbers[0]+".png"))); btnC2.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes1/c"+numbers[1]+".png"))); btnC3.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes1/c"+numbers[2]+".png"))); btnC4.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes1/c"+numbers[3]+".png"))); btnC5.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes1/c"+numbers[4]+".png"))); btnC6.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes1/c"+numbers[5]+".png"))); btnC7.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes1/c"+numbers[6]+".png"))); btnC8.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes1/c"+numbers[7]+".png"))); btnC9.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes1/c"+numbers[8]+".png"))); btnC10.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes1/c"+numbers[9]+".png"))); btnC11.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes1/c"+numbers[10]+".png"))); btnC12.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes1/c"+numbers[11]+".png"))); btnC13.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes1/c"+numbers[12]+".png"))); btnC14.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes1/c"+numbers[13]+".png"))); btnC15.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes1/c"+numbers[14]+".png"))); btnC16.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes1/c"+numbers[15]+".png"))); } private void btnEnabled(JButton btn) { if(!caraUp) { btn.setEnabled(false); im1 = (ImageIcon) btn.getDisabledIcon(); pbtn[0] = btn; caraUp = true; primerc = false; } else { btn.setEnabled(false); im2 = (ImageIcon) btn.getDisabledIcon(); pbtn[1] = btn; primerc = true; puntaje += 20; pregwin(); } } private void compare() { if(caraUp && primerc) { if(im1.getDescription().compareTo(im2.getDescription()) != 0) { pbtn[0].setEnabled(true); pbtn[1].setEnabled(true); if(puntaje > 10 ) puntaje -= 10; } caraUp = false; } } private void reiniciar() { btnC1.setEnabled(true); btnC2.setEnabled(true); btnC3.setEnabled(true); btnC4.setEnabled(true); btnC5.setEnabled(true); btnC6.setEnabled(true); btnC7.setEnabled(true); btnC8.setEnabled(true); btnC9.setEnabled(true); btnC10.setEnabled(true); btnC11.setEnabled(true); btnC12.setEnabled(true); btnC13.setEnabled(true); btnC14.setEnabled(true); btnC15.setEnabled(true); btnC16.setEnabled(true); primerc = false; caraUp = false; puntaje = 0; } private void pregwin() { if(!btnC1.isEnabled() && !btnC2.isEnabled() && !btnC3.isEnabled() && !btnC4.isEnabled() && !btnC5.isEnabled() && !btnC6.isEnabled() && !btnC7.isEnabled() && !btnC8.isEnabled() && !btnC9.isEnabled() && !btnC10.isEnabled() && !btnC11.isEnabled() && !btnC12.isEnabled() && !btnC13.isEnabled() && !btnC14.isEnabled() && !btnC15.isEnabled() && !btnC16.isEnabled()) { JOptionPane.showMessageDialog(this, "Felicidades, usted ha ganado. Su puntaje es: "+puntaje, "Win!!", JOptionPane.INFORMATION_MESSAGE); } } @SuppressWarnings("unchecked") // private void initComponents() {

jLabel1 = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); btnC1 = new javax.swing.JButton(); btnC2 = new javax.swing.JButton(); btnC3 = new javax.swing.JButton(); btnC4 = new javax.swing.JButton(); btnC8 = new javax.swing.JButton(); btnC7 = new javax.swing.JButton(); btnC6 = new javax.swing.JButton(); btnC5 = new javax.swing.JButton(); btnC12 = new javax.swing.JButton(); btnC11 = new javax.swing.JButton(); btnC10 = new javax.swing.JButton(); btnC9 = new javax.swing.JButton(); btnC16 = new javax.swing.JButton(); btnC15 = new javax.swing.JButton(); btnC14 = new javax.swing.JButton(); btnC13 = new javax.swing.JButton(); btnReiniciar = new javax.swing.JButton(); jButton1 = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Juego Dos Caras");

jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel1.setForeground(new java.awt.Color(102, 102, 102)); jLabel1.setText("Colors");

jPanel1.setBackground(new java.awt.Color(193, 127, 59));

btnC1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC1.setBorder(null); btnC1.setBorderPainted(false); btnC1.setContentAreaFilled(false); btnC1.setFocusable(false); btnC1.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC1MouseExited(evt); } }); btnC1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC1ActionPerformed(evt); } });

btnC2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC2.setBorder(null); btnC2.setBorderPainted(false); btnC2.setContentAreaFilled(false); btnC2.setFocusable(false); btnC2.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC2.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC2MouseExited(evt); } }); btnC2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC2ActionPerformed(evt); } });

btnC3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC3.setBorder(null); btnC3.setBorderPainted(false); btnC3.setContentAreaFilled(false); btnC3.setFocusable(false); btnC3.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC3.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC3MouseExited(evt); } }); btnC3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC3ActionPerformed(evt); } });

btnC4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC4.setBorder(null); btnC4.setBorderPainted(false); btnC4.setContentAreaFilled(false); btnC4.setFocusable(false); btnC4.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC4.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC4MouseExited(evt); } }); btnC4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC4ActionPerformed(evt); } });

btnC8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC8.setBorder(null); btnC8.setBorderPainted(false); btnC8.setContentAreaFilled(false); btnC8.setFocusable(false); btnC8.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC8.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC8MouseExited(evt); } }); btnC8.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC8ActionPerformed(evt); } });

btnC7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC7.setBorder(null); btnC7.setBorderPainted(false); btnC7.setContentAreaFilled(false); btnC7.setFocusable(false); btnC7.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC7.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC7MouseExited(evt); } }); btnC7.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC7ActionPerformed(evt); } });

btnC6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC6.setBorder(null); btnC6.setBorderPainted(false); btnC6.setContentAreaFilled(false); btnC6.setFocusable(false); btnC6.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC6.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC6MouseExited(evt); } }); btnC6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC6ActionPerformed(evt); } });

btnC5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC5.setBorder(null); btnC5.setBorderPainted(false); btnC5.setContentAreaFilled(false); btnC5.setFocusable(false); btnC5.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC5.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC5MouseExited(evt); } }); btnC5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC5ActionPerformed(evt); } });

btnC12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC12.setBorder(null); btnC12.setBorderPainted(false); btnC12.setContentAreaFilled(false); btnC12.setFocusable(false); btnC12.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC12.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC12MouseExited(evt); } }); btnC12.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC12ActionPerformed(evt); } });

btnC11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC11.setBorder(null); btnC11.setBorderPainted(false); btnC11.setContentAreaFilled(false); btnC11.setFocusable(false); btnC11.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC11.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC11MouseExited(evt); } }); btnC11.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC11ActionPerformed(evt); } });

btnC10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC10.setBorder(null); btnC10.setBorderPainted(false); btnC10.setContentAreaFilled(false); btnC10.setFocusable(false); btnC10.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC10.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC10MouseExited(evt); } }); btnC10.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC10ActionPerformed(evt); } });

btnC9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC9.setBorder(null); btnC9.setBorderPainted(false); btnC9.setContentAreaFilled(false); btnC9.setFocusable(false); btnC9.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC9.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC9MouseExited(evt); } }); btnC9.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC9ActionPerformed(evt); } });

btnC16.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC16.setBorder(null); btnC16.setBorderPainted(false); btnC16.setContentAreaFilled(false); btnC16.setFocusable(false); btnC16.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC16.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC16MouseExited(evt); } }); btnC16.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC16ActionPerformed(evt); } });

btnC15.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC15.setBorder(null); btnC15.setBorderPainted(false); btnC15.setContentAreaFilled(false); btnC15.setFocusable(false); btnC15.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC15.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC15MouseExited(evt); } }); btnC15.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC15ActionPerformed(evt); } });

btnC14.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC14.setBorder(null); btnC14.setBorderPainted(false); btnC14.setContentAreaFilled(false); btnC14.setFocusable(false); btnC14.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC14.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC14MouseExited(evt); } }); btnC14.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC14ActionPerformed(evt); } });

btnC13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/c0.png"))); // NOI18N btnC13.setBorder(null); btnC13.setBorderPainted(false); btnC13.setContentAreaFilled(false); btnC13.setFocusable(false); btnC13.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cr.png"))); // NOI18N btnC13.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseExited(java.awt.event.MouseEvent evt) { btnC13MouseExited(evt); } }); btnC13.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnC13ActionPerformed(evt); } });

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(btnC1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnC2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnC3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnC4)) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(btnC5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnC6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnC7) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnC8)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(btnC9) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnC10) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnC11) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnC12)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(btnC13) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnC14) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnC15) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnC16))) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btnC4) .addComponent(btnC2) .addComponent(btnC1) .addComponent(btnC3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btnC6) .addComponent(btnC5) .addComponent(btnC7) .addComponent(btnC8)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btnC9) .addComponent(btnC10) .addComponent(btnC11) .addComponent(btnC12)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btnC13) .addComponent(btnC14) .addComponent(btnC15) .addComponent(btnC16))) );

btnReiniciar.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N btnReiniciar.setForeground(new java.awt.Color(255, 0, 0)); btnReiniciar.setText("Reiniciar"); btnReiniciar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnReiniciarActionPerformed(evt); } });

jButton1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jButton1.setForeground(new java.awt.Color(0, 204, 0)); jButton1.setText("Siguiente"); jButton1.setPreferredSize(new java.awt.Dimension(83, 23)); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } });

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(12, Short.MAX_VALUE)) .addGroup(layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnReiniciar) .addGap(35, 35, 35) .addComponent(jLabel1) .addGap(36, 36, 36) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(31, 31, 31)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnReiniciar) .addComponent(jLabel1) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(12, Short.MAX_VALUE)) );

setSize(new java.awt.Dimension(400, 538)); setLocationRelativeTo(null); }//

private void btnReiniciarActionPerformed(java.awt.event.ActionEvent evt) { reiniciar(); }

private void btnC13ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC13); }

private void btnC13MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC14ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC14); }

private void btnC14MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC15ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC15); }

private void btnC15MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC16ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC16); }

private void btnC16MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC9ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC9); }

private void btnC9MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC10ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC10); }

private void btnC10MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC11ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC11); }

private void btnC11MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC12ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC12); }

private void btnC12MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC5ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC5); }

private void btnC5MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC6ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC6); }

private void btnC6MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC7ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC7); }

private void btnC7MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC8ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC8); }

private void btnC8MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC4ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC4); }

private void btnC4MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC3ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC3); }

private void btnC3MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC2ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC2); }

private void btnC2MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void btnC1ActionPerformed(java.awt.event.ActionEvent evt) { btnEnabled(btnC1); }

private void btnC1MouseExited(java.awt.event.MouseEvent evt) { // TODO add your handling code here: compare(); }

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { PlayGame_2 obj=new PlayGame_2(); obj.setVisible(true); dispose(); }

public static void main(String args[]) { /* Set the Nimbus look and feel */ // /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(PlayGame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(PlayGame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(PlayGame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(PlayGame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //

/* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new PlayGame_1().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton btnC1; private javax.swing.JButton btnC10; private javax.swing.JButton btnC11; private javax.swing.JButton btnC12; private javax.swing.JButton btnC13; private javax.swing.JButton btnC14; private javax.swing.JButton btnC15; private javax.swing.JButton btnC16; private javax.swing.JButton btnC2; private javax.swing.JButton btnC3; private javax.swing.JButton btnC4; private javax.swing.JButton btnC5; private javax.swing.JButton btnC6; private javax.swing.JButton btnC7; private javax.swing.JButton btnC8; private javax.swing.JButton btnC9; private javax.swing.JButton btnReiniciar; private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1; private javax.swing.JPanel jPanel1; // End of variables declaration }

PlayGame_2:package gui;

import auxiliar.LogicaJuego;import java.awt.BorderLayout;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JOptionPane;public class PlayGame_2 extends javax.swing.JFrame { private VFondo fondo; private LogicaJuego log = new LogicaJuego(); private boolean caraUp = false; private ImageIcon im1; private ImageIcon im2; private JButton[] pbtn = new JButton[2]; private boolean primerc = false; private int puntaje = 0; public PlayGame_2() { initComponents(); fondo = new VFondo(getWidth(), getHeight()); add(fondo, BorderLayout.CENTER); setCards(); } private void setCards() { int[] numbers = log.getCardNumbers(); btnC1.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes2/c"+numbers[0]+".png"))); btnC2.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes2/c"+numbers[1]+".png"))); btnC3.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes2/c"+numbers[2]+".png"))); btnC4.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes2/c"+numbers[3]+".png"))); btnC5.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes2/c"+numbers[4]+".png"))); btnC6.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes2/c"+numbers[5]+".png"))); btnC7.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes2/c"+numbers[6]+".png"))); btnC8.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes2/c"+numbers[7]+".png"))); btnC9.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes2/c"+numbers[8]+".png"))); btnC10.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes2/c"+numbers[9]+".png"))); btnC11.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes2/c"+numbers[10]+".png"))); btnC12.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes2/c"+numbers[11]+".png"))); btnC13.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes2/c"+numbers[12]+".png"))); btnC14.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes2/c"+numbers[13]+".png"))); btnC15.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes2/c"+numbers[14]+".png"))); btnC16.setDisabledIcon(new ImageIcon(getClass().getResource("../imagenes2/c"+numbers[15]+".png"))); } private void btnEnabled(JButton btn) { if(!caraUp) { btn.setEnabled(false); im1 = (ImageIcon) btn.getDisabledIcon(); pbtn[0] = btn; caraUp = true; primerc = false; } else { btn.setEnabled(false); im2 = (ImageIcon) btn.getDisabledIcon(); pbtn[1] = btn; primerc = true; puntaje += 20; pregwin(); } } private void compare() { if(caraUp && primerc) { if(im1.getDescription().compareTo(im2.getDescription()) != 0) { pbtn[0].setEnabled(true); pbtn[1].setEnabled(true); if(puntaje > 10 ) puntaje -= 10; } caraUp = false; } } private void reiniciar() { btnC1.setEnabled(true); btnC2.setEnabled(true); btnC3.setEnabled(true); btnC4.setEnabled(true); btnC5.setEnabled(true); btnC6.setEnabled(true); btnC7.setEnabled(true); btnC8.setEnabled(true); btnC9.setEnabled(true); btnC10.setEnabled(true); btnC11.setEnabled(true); btnC12.setEnabled(true); btnC13.setEnabled(true); btnC14.setEnabled(true); btnC15.setEnabled(true); btnC16.setEnabled(true); primerc = false; caraUp = false; puntaje = 0; } private void pregwin() { if(!btnC1.isEnabled() && !btnC2.isEnabled() && !btnC3.isEnabled() && !btnC4.isEnabled() && !btnC5.isEnabled() && !btnC6.isEnabled() && !btnC7.isEnabled() && !btnC8.isEnabled() && !btnC9.isEnabled() && !btnC10.isEnabled() && !btnC11.isEnabled() && !btnC12.isEnabled() && !btnC13.isEnabled() && !btnC14.isEnabled() && !btnC15.isEnabled() && !btnC16.isEnabled()) { JOptionPane.showMessageDialog(this, "Felicidades, usted ha ganado. Su puntaje es: "+puntaje, "Win!