Generador de quinielas

Iniciado por ProcessKill, Febrero 24, 2010, 04:23:19 PM

Tema anterior - Siguiente tema

0 Miembros y 2 Visitantes están viendo este tema.

Febrero 24, 2010, 04:23:19 PM Ultima modificación: Abril 18, 2013, 12:44:36 PM por Expermicid
Bueno aqui les dejo un programita hecho por mi que sirve para generar quinielas de futbol aleatorias , bueno aca les pongo el code y una imagen :)

Código: java

import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
class Kaiser extends JFrame{
    JLabel cuadro;
    JLabel cuadro1;
    JLabel cuadro2;
    JLabel cuadro3;
    JLabel cuadro4;
    JLabel cuadro5;
    JLabel cuadro6;
    JLabel cuadro7;
    JLabel cuadro8;
    JLabel cuadro9;
    JLabel cuadro10;
    JLabel cuadro11;
    JLabel cuadro12;
    JLabel cuadro13;
    JLabel cuadro14;
    JLabel primero;
    JLabel segundo;
    JLabel tercero;
    JLabel cuarto;
    JLabel quinto;
    JLabel sexto;
    JLabel septimo;
    JLabel octavo;
    JLabel noveno;
    JLabel decimo;
    JLabel onceavo;
    JLabel doceavo;
    JLabel treceavo;
    JLabel catorceavo;
    JLabel pleno;
    JButton generar;
    JLabel kaiser;
       
    public Kaiser(){
        Container panel;   
        panel=getContentPane();
        panel.setLayout(null);
        setSize(1000,1000);
        Font letra;
        letra=new Font("Comic sans",Font.BOLD,50);
        this.kaiser=new JLabel("BY K4[I]S3R");
        kaiser.setBounds(100,450,300,300);
        kaiser.setForeground(java.awt.Color.RED);
        kaiser.setFont(letra);
        panel.add(kaiser);
        this.primero=new JLabel("Primero: ");
        primero.setBounds(10,10,100,20);
        panel.add(primero);
        this.cuadro=new JLabel("");
        cuadro.setBounds(80,10,100,20);
        panel.add(cuadro);
        this.segundo=new JLabel("Segundo: ");
        segundo.setBounds(10,40,100,20);
        panel.add(segundo);
        this.cuadro1=new JLabel("");
        cuadro1.setBounds(80,40,100,20);
        panel.add(cuadro1);
        this.tercero=new JLabel("Tercero: ");
        tercero.setBounds(10,70,100,20);
        panel.add(tercero);
        this.cuadro2=new JLabel("");
        cuadro2.setBounds(80,70,100,20);
        panel.add(cuadro2);
        this.cuarto=new JLabel("Cuarto: ");
        cuarto.setBounds(10,100,100,20);
        panel.add(cuarto);
        this.cuadro3=new JLabel("");
        cuadro3.setBounds(80,100,100,20);
        panel.add(cuadro3);
        this.quinto=new JLabel("Quinto: ");
        quinto.setBounds(10,130,100,20);
        panel.add(quinto);
        this.cuadro4=new JLabel("");
        cuadro4.setBounds(80,130,100,20);
        panel.add(cuadro4);
        this.sexto=new JLabel("Sexto: ");
        sexto.setBounds(10,160,100,20);
        panel.add(sexto);
        this.cuadro5=new JLabel("");
        cuadro5.setBounds(80,160,100,20);
        panel.add(cuadro5);
        this.septimo=new JLabel("Septimo: ");
        septimo.setBounds(10,190,100,20);
        panel.add(septimo);
        this.cuadro6=new JLabel("");
        cuadro6.setBounds(80,190,100,20);
        panel.add(cuadro6);
        this.octavo=new JLabel("Octavo: ");
        octavo.setBounds(10,220,100,20);
        panel.add(octavo);
        this.cuadro7=new JLabel("");
        cuadro7.setBounds(80,220,100,20);
        panel.add(cuadro7);
        this.noveno=new JLabel("Noveno: ");
        noveno.setBounds(10,250,100,20);
        panel.add(noveno);
        this.cuadro8=new JLabel("");
        cuadro8.setBounds(80,250,100,20);
        panel.add(cuadro8);
        this.decimo=new JLabel("Decimo: ");
        decimo.setBounds(10,280,100,20);
        panel.add(decimo);
        this.cuadro9=new JLabel("");
        cuadro9.setBounds(80,280,100,20);
        panel.add(cuadro9);
        this.onceavo=new JLabel("Onceavo");
        onceavo.setBounds(10,310,100,20);
        panel.add(onceavo);
        this.cuadro10=new JLabel("");
        cuadro10.setBounds(80,310,100,20);
        panel.add(cuadro10);
        this.doceavo=new JLabel("Doceavo: ");
        doceavo.setBounds(10,340,100,20);
        panel.add(doceavo);
        this.cuadro11=new JLabel("");
        cuadro11.setBounds(80,340,100,20);
        panel.add(cuadro11);
        this.treceavo=new JLabel("Treceavo: ");
        treceavo.setBounds(10,370,100,20);
        panel.add(treceavo);
        this.cuadro12=new JLabel("");
        cuadro12.setBounds(80,370,100,20);
        panel.add(cuadro12);
        this.catorceavo=new JLabel("Catorceavo: ");
        catorceavo.setBounds(10,400,100,20);
        panel.add(catorceavo);
        this.cuadro13=new JLabel("");
        cuadro13.setBounds(90,400,100,20);
        panel.add(cuadro13);
        this.pleno=new JLabel("Pleno al quince");
        pleno.setBounds(10,430,100,20);
        panel.add(pleno);
        this.cuadro14=new JLabel("");
        cuadro14.setBounds(120,430,100,20);
        panel.add(cuadro14);
        this.generar=new JButton("generar");
        generar.setBounds(10,460,100,20);
        panel.add(generar);
        Evento ev;
        ev=new Evento();
        generar.addActionListener(ev);
       
       
    }
   
    public void mostrar(){
        setVisible(true);
    }

           
           
   class Evento implements ActionListener{
        public void actionPerformed(ActionEvent e){
         JButton c;
         String texto;
         int c1;
         int c2;
         int c3;
         int c4;
         int c5;
         int c6;
         int c7;
         int c8;
         int c9;
         int c10;
         int c11;
         int c12;
         int c13;
         int c14;
         int c15;
         int uno;
         int dos;
         int tres;
 
             
       
         
             
         c=(JButton) e.getSource();
         texto=c.getActionCommand();
         if (texto.compareTo("generar")==0){
             
             c1=(int)(Math.random()*3);
         
            if (c1==0){
             cuadro.setText("X");
            }
             else {
                cuadro.setText(""+c1);
            }

             c2=(int)(Math.random()*3);
             
            if (c2==0){
             cuadro1.setText("X");
            }
             else {
                cuadro1.setText(""+c2);
            }
           
             c3=(int)(Math.random()*3);
             
             if (c3==0){
                cuadro2.setText("X");
            }
             else {
                cuadro2.setText(""+c3);
            }
           
             c4=(int)(Math.random()*3);
             
             if (c4==0){
                cuadro3.setText("X");
            }
             else {
                cuadro3.setText(""+c4);
            }
           
             c5=(int)(Math.random()*3);
             
             if (c5==0){
                cuadro4.setText("X");
            }
             else {
                cuadro4.setText(""+c5);
            }
             
             c6=(int)(Math.random()*3);
             
             if (c6==0){
                cuadro5.setText("X");
            }
             else {
                cuadro5.setText(""+c6);
            }
             
             c7=(int)(Math.random()*3);
             
             if (c7==0){
                cuadro6.setText("X");
            }
             else {
                cuadro6.setText(""+c7);
            }
             
             c8=(int)(Math.random()*3);
             
            if (c8==0){
                cuadro7.setText("X");
            }
             else {
                cuadro7.setText(""+c8);
            }
             
             c9=(int)(Math.random()*3);
             
             if (c9==0){
                cuadro8.setText("X");
            }
             else {
                cuadro8.setText(""+c9);
            }
             
             c10=(int)(Math.random()*3);
             
             if (c10==0){
                cuadro9.setText("X");
            }
             else {
                cuadro9.setText(""+c10);
            }
             
             c11=(int)(Math.random()*3);
             
             if (c11==0){
                cuadro10.setText("X");
            }
             else {
                cuadro10.setText(""+c11);
            }
             
             c12=(int)(Math.random()*3);
             
             if (c12==0){
                cuadro11.setText("X");
            }
             else {
                cuadro11.setText(""+c12);
            }
             
             c13=(int)(Math.random()*3);
             
             if (c13==0){
                cuadro12.setText("X");
            }
             else {
                cuadro12.setText(""+c13);
            }
             
             c14=(int)(Math.random()*3);
             
             if (c14==0){
                cuadro13.setText("X");
            }
             else {
                cuadro13.setText(""+c14);
            }
             
             c15=(int)(Math.random()*3);
             
             if (c15==0){
                cuadro14.setText("X");
            }
             else {
                cuadro14.setText(""+c15);
            }           
           
            }
        }
    }
}


la imagen



:D