Stroke

Strokes are much more than line widths. They can be used to specify decorated outlines, or stylistic representation of the outlines. You'll need to read about the Java class java.awt.BasicStroke to learn more about simple strokes.

To specify a stroke that can change 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 myStroke, of type Object, the line:

  myStroke = java.awt.BasicStroke(1.5f);
can be used in the Java code of your program to create a line width of 1.5 points. The f at the end of the 1.5f number above is important.

The above procedure is of interest if you need sophisticated strokes. However, if you what you want is just to change the line width dynamically, you can just associate the stroke property with a variable of type double.