import javax.swing.JOptionPane;
import java.util.Random;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Presario
 */
public class juego6 extends javax.swing.JFrame {
private int limite =12;
    private int x;
    private int j;
    private int p;
    private int o;
    private int a;
    private int b;
    private int c;
    private int d;
    private int e;
    private int f;
    private int g;
    private int h;
    private int l;
    private int ;
    private int n;
    private int m;
    private int res9;
    private int res0;
    private float res;
    private float res2;
    private int res3;
    private int res4;
    private int res5;
    private int res6;
    private int aces;
    private int restotal;
    private String nombre;
    private String suma2;
    private String suma5;
    private String suma11;
    /**
     * Creates new form juego6
     */
    public juego6() {
       initComponents();
         setSize(900, 600);
         setLocationRelativeTo(null);
         setResizable(false);
         setTitle("MATEMATICAS");
         
      
         for (int i = 0; i < 1; i++) {
            Random valor = new Random();
            p = valor.nextInt(limite + 1);
            if (p == 0) {
                p++;
            }
            for (int a = 0; a < 1; a++) {
                Random juan = new Random();
                o = juan.nextInt(limite + 1);
                if (o == 0) {
                    o++;
                }
                
                
            }  
         
         }
         for (int i = 0; i < 1; i++) {
            Random valor = new Random();
            x = valor.nextInt(limite + 1);
            if (x == 0) {
                x++;
            }
            for (int a = 0; a < 1; a++) {
                Random juan = new Random();
                j = juan.nextInt(limite + 1);
                if (j == 0) {
                    j++;
                }
                
                
            } 
         }
         for (int i = 0; i < 1; i++) {
            Random valor = new Random();
            l = valor.nextInt(limite + 1);
            if (l == 0) {
                l++;
            }
            for (int a = 0; a < 1; a++) {
                Random juan = new Random();
                 = juan.nextInt(limite + 1);
                if ( == 0) {
                    ++;
                }
            }
                
            } 
         for (int i = 0; i < 1; i++) {
            Random valor = new Random();
            n = valor.nextInt(limite + 1);
            if (n == 0) {
                n++;
            }
            for (int a = 0; a < 1; a++) {
                Random juan = new Random();
                m = juan.nextInt(limite + 1);
                if (m == 0) {
                    m++;
                }
            }
         }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        inicio = new javax.swing.JButton();
        divi1 = new javax.swing.JButton();
        nombre2 = new javax.swing.JTextField();
        bien1 = new javax.swing.JButton();
        mal1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(null);

        jLabel1.setFont(new java.awt.Font("Comic Sans MS", 3, 24)); // NOI18N
        jLabel1.setText("DIVISION");
        getContentPane().add(jLabel1);
        jLabel1.setBounds(223, 21, 190, 34);

        inicio.setText("INICIO");
        inicio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                inicioActionPerformed(evt);
            }
        });
        getContentPane().add(inicio);
        inicio.setBounds(580, 50, 99, 25);

        divi1.setText("DIVISION");
        divi1.setEnabled(false);
        divi1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                divi1ActionPerformed(evt);
            }
        });
        getContentPane().add(divi1);
        divi1.setBounds(420, 100, 105, 25);

        nombre2.setEnabled(false);
        getContentPane().add(nombre2);
        nombre2.setBounds(220, 100, 180, 30);

        bien1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/bien.jpg"))); // NOI18N
        bien1.setBorder(null);
        bien1.setBorderPainted(false);
        bien1.setContentAreaFilled(false);
        bien1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        bien1.setEnabled(false);
        getContentPane().add(bien1);
        bien1.setBounds(70, 90, 50, 49);

        mal1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mal.png"))); // NOI18N
        mal1.setBorder(null);
        mal1.setBorderPainted(false);
        mal1.setContentAreaFilled(false);
        mal1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        mal1.setEnabled(false);
        getContentPane().add(mal1);
        mal1.setBounds(130, 90, 50, 50);

        pack();
    }// </editor-fold>                        

    private void divi1ActionPerformed(java.awt.event.ActionEvent evt) {                                      
        // TODO add your handling code here:
         
        divi1.setEnabled(false);
        if(x<j){
        nombre=JOptionPane.showInputDialog(j + " / " + x + " = " );    
        nombre2.setText(nombre);
        res = (j/x); 
        res2=Integer.parseInt(nombre);
        }else{
        nombre=JOptionPane.showInputDialog(j + " / " + x + " = " );
        nombre2.setText(nombre);
        res = (x/j); 
        res2=Integer.parseInt(nombre);
        }
        
        if (res2==res){
            bien1.setEnabled(true);
            a=1;
        }else{
            mal1.setEnabled(true);
            b=1;
        } 
    }                                     

    private void inicioActionPerformed(java.awt.event.ActionEvent evt) {                                       
        // TODO add your handling code here:
        divi1.setEnabled(true);
        inicio.setEnabled(false);
    }                                      

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* 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(juego6.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(juego6.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(juego6.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(juego6.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new juego6().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify                     
    private javax.swing.JButton bien1;
    private javax.swing.JButton divi1;
    private javax.swing.JButton inicio;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JButton mal1;
    private javax.swing.JTextField nombre2;
    // End of variables declaration                   
}
