Buenas quisiera ayuda... Estoy muy trabado con esto. Es sobre threads. No me instancia mas de un auto. Vean el codigo esta dado clase por clase. Esta programado en NETBEANS 7.2
Código Java:
Ver originalpackage ciudad;
public class Auto {
public int x;
public int y;
public int velocidad;
public Auto
(Image imagen,
int x,
int y,
int velocidad
) { this.imagen = t.getImage("auto.gif");
this.x = x;
this.y = y;
this.velocidad = velocidad;
}
}
package ciudad;
i
public class Interfaz {
private final int LARGO_IMAGENES = 15;
private final int ALTURA_IMAGENES = 15;
Pixel x = new Pixel("x", 0, "9", cin);
Pixel a = new Pixel("rigth", 1, null, cua); // calle derecha
Pixel b = new Pixel("left", 2, null, tre); //calle izquierda
Pixel c = new Pixel("down", 3, null, dos); // calle abajo
Pixel d = new Pixel("up", 4, null, uno); // calle arriba
Pixel e = new Pixel("e", 5, null, inter); // interseccion
public Pixel InterfazActual[][] = {
{x, x, x, x, a, x, x, x, x, a, x, x, x, x, b, x, x, x, x, a, x, x, x, x, a, b},
{x, x, x, x, a, x, x, x, x, a, x, x, x, x, b, x, x, x, x, a, x, x, x, x, a, b},
{x, x, x, x, a, x, x, x, x, a, x, x, x, x, b, x, x, x, x, a, x, x, x, x, a, b},
{x, x, x, x, a, x, x, x, x, a, x, x, x, x, b, x, x, x, x, a, x, x, x, x, a, b},
{c, c, c, c, e, c, c, c, c, e, c, c, c, c, e, c, c, c, c, e, c, c, c, c, e, e},
{x, x, x, x, a, x, x, x, x, a, x, x, x, x, b, x, x, x, x, a, x, x, x, x, a, b},
{x, x, x, x, a, x, x, x, x, a, x, x, x, x, b, x, x, x, x, a, x, x, x, x, a, b},
{x, x, x, x, a, x, x, x, x, a, x, x, x, x, b, x, x, x, x, a, x, x, x, x, a, b},
{x, x, x, x, a, x, x, x, x, a, x, x, x, x, b, x, x, x, x, a, x, x, x, x, a, b},
{d, d, d, d, e, d, d, d, d, e, d, d, d, d, e, d, d, d, d, e, d, d, d, d, e, e},
{c, c, c, c, e, c, c, c, c, e, c, c, c, c, e, c, c, c, c, e, c, c, c, c, e, e},
{x, x, x, x, a, x, x, x, x, a, x, x, x, x, b, x, x, x, x, a, x, x, x, x, a, b},
{x, x, x, x, a, x, x, x, x, a, x, x, x, x, b, x, x, x, x, a, x, x, x, x, a, b},
{x, x, x, x, a, x, x, x, x, a, x, x, x, x, b, x, x, x, x, a, x, x, x, x, a, b},
{x, x, x, x, a, x, x, x, x, a, x, x, x, x, b, x, x, x, x, a, x, x, x, x, a, b},
{c, c, c, c, e, c, c, c, c, e, c, c, c, c, e, c, c, c, c, e, c, c, c, c, e, e},
{x, x, x, x, a, x, x, x, x, a, x, x, x, x, b, x, x, x, x, a, x, x, x, x, a, b},
{x, x, x, x, a, x, x, x, x, a, x, x, x, x, b, x, x, x, x, a, x, x, x, x, a, b},
{x, x, x, x, a, x, x, x, x, a, x, x, x, x, b, x, x, x, x, a, x, x, x, x, a, b},
{x, x, x, x, a, x, x, x, x, a, x, x, x, x, b, x, x, x, x, a, x, x, x, x, a, b},
{c, c, c, c, e, c, c, c, c, e, c, c, c, c, e, c, c, c, c, e, c, c, c, c, e, e},
{d, d, d, d, e, d, d, d, d, e, d, d, d, d, e, d, d, d, d, e, d, d, d, d, e, e},
{x, x, x, x, a, x, x, x, x, a, x, x, x, x, b, x, x, x, x, a, x, x, x, x, a, b},
{x, x, x, x, a, x, x, x, x, a, x, x, x, x, b, x, x, x, x, a, x, x, x, x, a, b},
{x, x, x, x, a, x, x, x, x, a, x, x, x, x, b, x, x, x, x, a, x, x, x, x, a, b},
{x, x, x, x, a, x, x, x, x, a, x, x, x, x, b, x, x, x, x, a, x, x, x, x, a, b},};
public String DeolverCodigoImagenMatriz
(int Fila,
int Columna
) { return InterfazActual[Fila][Columna].getTipo();
}
public int DevolverLargoImagenes() {
return LARGO_IMAGENES;
}
public int DevolverAlturaImagenes() {
return ALTURA_IMAGENES;
}
public int DevolverSentido(int Fila, int Columna) {
return InterfazActual[Fila][Columna].getSentido();
}
}
package ciudad;
public class Pixel {
this.tipo = tipo;
this.sentido = sentido;
this.contiene = contiene;
this.panel = panel;
}
return panel;
}
public void setPanel
(JPanel panel
) { this.panel = panel;
}
return tipo;
}
public void setTipo
(String tipo
) { this.tipo = tipo;
}
return sentido;
}
public void setSentido
(Integer sentido
) { this.sentido = sentido;
}
return contiene;
}
public void setContiene
(String contiene
) { this.contiene = contiene;
}
}
En el paquete Images solo estan las imagenes para que funcionen los autos. Espero su ayuda muchas gracias.