ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Como se da el Código Picas y Palas


Enviado por   •  9 de Junio de 2017  •  Tutoriales  •  2.116 Palabras (9 Páginas)  •  96 Visitas

Página 1 de 9

import java.awt.BorderLayout;

import java.awt.Font;

import java.awt.Panel;

import java.awt.TextArea;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.util.Random;

import java.util.logging.Level;

import java.util.logging.Logger;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JTextField;

import javax.swing.UIManager;

import javax.swing.UnsupportedLookAndFeelException;

 

public class Tales implements ActionListener{

 

    Random aleatorio = new Random ();

    String numIngresado="", resul="RESULTADO \n \n";

    char numGen[] = new char[ 4 ]; //arreglo que almacenara el numero de 4 digitos generado

    int fijas, picas, paso;

    boolean estado = false;

 

    //objetos para la GUI de la APP.

    Panel p1, p2;

    JButton jb1, jb2;

    JLabel jl1, jl2, tituloFrame;

    JTextField jt1;

    TextArea jtA1;

 

    public Tales(){

 

        JFrame fMain = new JFrame("Fijas y Picas :D ");

        fMain.setLayout( new BorderLayout(4, 6));

 

        iz();

        der();

 

        fMain.add(p1, BorderLayout.WEST);

        fMain.add(p2, BorderLayout.EAST);

 

        fMain.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        fMain.setResizable(false);

        fMain.setSize(650, 450);

        fMain.setLocation(100, 60);

        fMain.setVisible(true);

    }

 

    public void iz(){

 

        p1 = new Panel();

        p1.setLayout(null);

 

        jl1 = new JLabel("JUGADAS");

        jl2 = new JLabel("Apuesta  ");

 

        jt1 = new JTextField(4);

 

        jb1 = new JButton("Jugar");

        jb2 = new JButton("Reiniciar");

 

        jl1.setFont(new Font("Verdana", Font.BOLD, 20));

        jt1.setHorizontalAlignment(JTextField.RIGHT);

 

        jb2.setEnabled(false); jt1.setEditable(false);

 

 

        jl1.setBounds(10, 15, 125, 25);

 

        jl2.setBounds(5, 60, 95, 25);

        jt1.setBounds(110, 60, 60, 25);

 

        jb1.setBounds(10, 120, 80, 25);

        jb2.setBounds(10, 150, 97, 25);

 

        p1.add(jl1); p1.add(jl2); p1.add(jt1); p1.add(jb1); p1.add(jb2);

 

        jb1.addActionListener(this); jb2.addActionListener(this);

...

Descargar como (para miembros actualizados)  txt (6.9 Kb)   pdf (93.9 Kb)   docx (18.8 Kb)  
Leer 8 páginas más »
Disponible sólo en Clubensayos.com