2016-06-20 13:25:01 -04:00
|
|
|
package cl.cromer.estructuras;
|
|
|
|
|
|
|
|
import javafx.scene.paint.Color;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Rotación de colores.
|
2016-06-29 00:33:19 -04:00
|
|
|
*
|
2016-06-20 13:25:01 -04:00
|
|
|
* @author Chris Cromer
|
|
|
|
*/
|
|
|
|
public class Colores {
|
2016-07-03 11:28:26 -04:00
|
|
|
/**
|
|
|
|
* Cuantos colores estan definidos en esta clase.
|
|
|
|
*/
|
|
|
|
static final public int MAX_COLORS = 7;
|
2016-06-20 13:25:01 -04:00
|
|
|
|
2016-07-03 11:28:26 -04:00
|
|
|
/**
|
|
|
|
* El color actual en forma numerica.
|
|
|
|
*/
|
|
|
|
private int color;
|
2016-06-20 13:25:01 -04:00
|
|
|
|
2016-07-03 11:28:26 -04:00
|
|
|
/**
|
|
|
|
* El color de texto actual.
|
|
|
|
*/
|
|
|
|
private Color texto;
|
2016-06-20 13:25:01 -04:00
|
|
|
|
2016-07-03 11:28:26 -04:00
|
|
|
/**
|
|
|
|
* El color de fondo actual.
|
|
|
|
*/
|
|
|
|
private Color fondo;
|
2016-06-20 13:25:01 -04:00
|
|
|
|
2016-07-03 11:28:26 -04:00
|
|
|
/**
|
|
|
|
* Inicializar el primer color.
|
|
|
|
*/
|
|
|
|
public Colores() {
|
|
|
|
siguinteColor();
|
|
|
|
}
|
2016-06-20 13:25:01 -04:00
|
|
|
|
2016-07-03 11:28:26 -04:00
|
|
|
/**
|
|
|
|
* Cambiar el color al siguinte. Si no hay, voler al primer.
|
|
|
|
*/
|
|
|
|
public void siguinteColor() {
|
|
|
|
switch (color) {
|
|
|
|
case 1:
|
|
|
|
color = 2;
|
|
|
|
texto = Color.WHITE;
|
|
|
|
fondo = Color.RED;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
color = 3;
|
|
|
|
texto = Color.BLACK;
|
|
|
|
fondo = Color.WHITE;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
color = 4;
|
|
|
|
texto = Color.BLACK;
|
|
|
|
fondo = Color.PINK;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
color = 5;
|
|
|
|
texto = Color.BLACK;
|
|
|
|
fondo = Color.YELLOW;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
color = 6;
|
|
|
|
texto = Color.BLACK;
|
|
|
|
fondo = Color.GREEN;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
color = 7;
|
|
|
|
texto = Color.BLACK;
|
|
|
|
fondo = Color.ORANGE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
color = 1;
|
|
|
|
texto = Color.WHITE;
|
|
|
|
fondo = Color.BLUE;
|
|
|
|
}
|
|
|
|
}
|
2016-06-20 13:25:01 -04:00
|
|
|
|
2016-07-03 11:28:26 -04:00
|
|
|
/**
|
|
|
|
* Devolver el color del texto actual.
|
|
|
|
*
|
|
|
|
* @return Color: Color del texto.
|
|
|
|
*/
|
|
|
|
public Color getTexto() {
|
|
|
|
return texto;
|
|
|
|
}
|
2016-06-20 13:25:01 -04:00
|
|
|
|
2016-07-03 11:28:26 -04:00
|
|
|
/**
|
|
|
|
* Devolver el color del fondo actual.
|
|
|
|
*
|
|
|
|
* @return Color: Color del fondo.
|
|
|
|
*/
|
|
|
|
public Color getFondo() {
|
|
|
|
return fondo;
|
|
|
|
}
|
2016-06-20 13:25:01 -04:00
|
|
|
}
|