Element: Function.

Icon: 

Text: A text field that defines a function.

Description: A Function is a basic element that displays and allow editing a value of type String. The string is then interpreted as a function of one variable and can be accessed using the _view.getFunction( ) method as follows:

double x = _view.getFunction ("Function","function").eval(0.1);

where "Function" is the name of the view element in Ejs' tree of elements and "function" is a keyword that identifies this functionality.
See an example of use in _examples/Elements/Basic/Function.xml.

The element invokes an action when the function displayed is modified.


Note: This image includes also an element of type Label.

When editing the displayed value, the change is only accepted when the Enter key is hit. To make this evident, the background of the field will change color while you type, displaying the original background color when the new value is accepted. 

Table of properties

Name Description Values accepted
Main
Java Syntax Whether the expressions for the function must be specified using the (more strict) Java syntax (such as Math.exp(x) or Math.sin(x)) or in a more relaxed form (such as e^x or sin(x)). A boolean variable or one of the constants true or false.
Function The expression of the function. A constant or variable of type String.
Value An initial value for the function. Any constant or variable of type String.
Variable The name of the free variable used in the function. A constant or variable of type String.
Editable Whether the function displayed can be modified or not. A boolean variable or one of the constants true or false.
Action The action to invoke when the value is modified. The Java code to invoke for the action. 
Graphical Aspect
Size The size of the element. An Object variable of the class java.awt.Dimension or the integer values for the width and the height, respectively, separated by a comma.
Background The color used for the background of the element. An Object variable of the class java.awt.Color or one of the predefined colors: black, blue, cyan, darkGray, gray, green, lightGray, magenta, orange, pink, red, white, yellow.

A color can also be specified providing its integer RGB coordinates (between 0 and 255), plus an optional transparency coordinate.

The default value is decided by the system.

Foreground The color used for the text displayed by the element. See the values for the Background property.
Font The font used for the text displayed by the element. An Object variable of the class java.awt.Font or a set of family, style and size, separated by commas. The style must be one of  plain, bold, italic, bold | italic. Example: Monospaced,italic,18.

The default value is decided by the system.

Tooltip The text displayed when the cursor lingers on top of the element. Any constant or variable of type String.