You are on page 1of 2

/*

Label.java
Autores:
Luis 10382
Luis Pedro 10073
Jose M. 10784
20 de noviembre de 2010
Descripcion: son los label para mostrar textos
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.text.DecimalFormat;
import java.util.Random;
public class Label extends JPanel{
//Atributos
protected JLabel imagen;
protected boolean marcado, ocupado;
protected int color,tipo;

public Label(int color, int tipoR){


this.color = color;
this.tipo=tipoR;
ocupado = false;
marcado=false;
//Distinguir si es Windows el sistema operativo
if(System.getProperty("os.name").toLowerCase().startsWith("windows"))
imagen = new JLabel(new ImageIcon(".\\Imagenes\\00000.jpg"));
else
imagen = new JLabel(new ImageIcon("./Imagenes/000000.jpg"));

//Agregar componentes a StakkaPanel


add(imagen);
switch(color){
case 3:
setBackground(Color.orange);
break;
default:
setBackground(Color.black);
}
setPreferredSize(new Dimension(40, 40));
}
public void cambiarColor(int color){
switch(color){
case 0:
setBackground(Color.red);
break;
case 1:
setBackground(Color.green);
break;
case 2:
setBackground(Color.gray);
break;
case 3:
setBackground(Color.blue);
break;
case 4:
setBackground(Color.white);
}
this.color=color;

}
public void setColor(int color){
this.color=color;
}
public int getColor(){
return color;
}

public void setOcupado(boolean ocupado){


this.ocupado=ocupado;
}
public boolean getOcupado(){
return ocupado;
}
public void setMarcado(boolean marcado){
this.marcado=marcado;
}
public boolean getMarcado(){
return marcado;
}

You might also like