Un sencillo juego de dados

Páginas: 7 (1719 palabras) Publicado: 10 de noviembre de 2011
UNIVERSIDAD TECINICA DE MACHALA

FACULTAD DE INGENIERIA CIVIL
Escuela de Informática

PROGRAMACIÓN ESTRUCTURADA
ESTUDIANTE: Luis Fernando Aguilar Merino
QUIMESTRE: Primer Quimestre
AÑO: 2011
TEMA:

“*DADOS”

INTRODUCCIÓN
Este juego es un simple juego de dados en el que intervienen imágenes.

Objetivo
Obtener el valor más alto y ganar al oponente.

Desarrollo
Estejuego fue desarrollado con la utilización de unos cuantos componentes del lenguaje JAVA consta de un JFrame como ventana y varias etiquetas JLabel, la utilización de la clase MATH para los valores aleatorios unos cuantos JButton y los indispensables JPanel BorderLayout y GridLayout.
Su desarrollo es de lo más sencillo y su utilidad esta destinada a la diversión.

En algunos casos ya que el juegoque consta de imágenes para la visualización de los dados y lo que tiene que ver elegir al ganador mostrara ciertas casualidades de acuerdo a lo que se ha escrito en el código me hubiera gustado que fuera más complejo pero en definitiva por cuestiones de tiempo ciertos inconvenientes será de lo más simple.

CÓDIGO
package dado;

import java.awt.BorderLayout;
import java.awt.Color;
importjava.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;

import javax.swing.ImageIcon;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class Juego {
// private static final String FICHERO = null;

//******************************
// PARTE GRAFICA DE LA VENTANA
// ******************************

public static void crearVentana() {
jfVentana = new JFrame();// CREACION DE NUESTRA VENTANA PRINCIPAL
jfVentana.setTitle("JUEGALO TODO *DADOS ");// NOMBRE DE LA VENTANA
jfVentana.setVisible(true);// HABILITA O DESHABILITA LA VENTANA PARA
// SER VISUALIZADA
jfVentana.setSize(900, 700);//LAS DIMENSIONES
jfVentana.setLocationRelativeTo(null);// UBICACION DE LA VENTANA, EN
// ESTE CASO CENTRADA
}

public static void crearPanelPrincipal() {// CREACION DE NUESTRO panel
// PRINCIPAL QUE SERA UN
// BORDERLAYOUT
jpPanelPrincipal = new JApplet();
jpPanelPrincipal.setLayout(new BorderLayout());// ORDENA LOS
// COMPONENTES DE FORMA
// N, S, E, O.
}private static int aleatorio, op, us, controlador; // representa a nuestro numero

// aleatorio

private static JLabel jlDadoUs = null;

private static JLabel jlPuntajeUs = null;

private static JLabel jlDadoOp = null;

private static JLabel jlPuntajeOp = null;

private static JApplet jpPanelPrincipal = null;

private static JLabel jlIntroduccion = null;

private static JPaneljpPanelAccion = null;

private static JButton jbJugarOtraVez = null;

private static JButton jbLanzar = null;

private static JButton jbMostrarDadoOp = null;

private static JButton jbSalir = null;

private static JPanel jpPanelJuego = null;

private static JPanel jpPanelOponente = null;

private static JLabel jlOponente = null;

private static JPanel jpPanelUsuario =null;

private static JLabel jlUsuario = null;

private static JFrame jfVentana = null;

public static void main(String[] args) { // METODO PRNCIPAL Y CONSTRUCTOR
// DE NUESTRA APLICASION
Componentes();
}

// ******************************
// PARTE GRAFICA DEL JUEGO
// ******************************

private static void Componentes() {
crearVentana();crearPanelPrincipal();
introduccion();

PanelJuego();
PanelOponente();
crearEtiquetaOponente();
crearDado1Op();
crearDado2Op();
PanelUsuario();
crearEtiquetaUsuario();
crearDado1Us();
crearDado2Us();

PanelAccion();
BotonJugarNuevamente();
MostrarDadoOp();
BotonLanzar();
BotonSalir();

//******************************
// ADERIMOS LOS COMPONENTES
//...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • juego de dados
  • Juegos-Dados
  • Dios no juega a los dados con el universo
  • Dios Si Juega A Los Dados
  • Dios Si Juega A Los Dados
  • Juego de lanzar dados en "c"
  • PROPUESTA DIDÁCTICA: EL JUEGO DEL DADO
  • Dios si juega a los dados

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS