Cambios Recientes - Buscar:

Information

Installation

Documentation

Feedback

 

 

Statistics

 

ElementsAboutColors

Colors in Ejs View Elements

 

A static color (i.e. a color that will not change during the execution of the simulation) for a given view element property is specified in Ejs using either one of the predefined Ejs colors:

BLACKBLUECYANDARKGRAY
GRAYGREENLIGHTGRAYMAGENTA
ORANGEPINKREDWHITE
YELLOW

or providing its integer RGB coordinates (between 0 and 255), plus an optional transparency coordinate, as in 0,253,12,255. Just type the desired value in the corresponding view element property. A specialized color chooser can also help you choose a given static color.

 

To specify a color that changes in run-time, you'll need to declare a variable of type Object, associate it to the corresponding element property, and then change the variable according to your program's logic.

 

For instance, if you declare a variable in Ejs called myColor, of type Object, the lines:
  myColor = java.awt.Color.RED;
  myColor = new java.awt.Color(255,0,0);
can both be used in the Java code of your program to create a solid red color in run-time. The associated view element property will change accodingly.

 

If you need semi-transparent colors, use something like:
  myColor = new java.awt.Color(255,0,0,127);
The last parameter is the level of transparency desired. 255 makes a full solid color. Semi-transparent colors may slow down a little bit your program.

Editar - Historia - Imprimir - Cambios Recientes - Buscar
Última modificación de la página el 01 January 2008 a las 23h38