A JavaCode function is a [https://www.javatpoint.com/static-function-in-java|Java static function] written in [JavaCode|JavaCode] (so it can directly refer to [JSup tag|tags], [JSup security groups|security group], [JSup alarm groups|alarm groups], [JSup graphic windows|windows]) that can be called from other [JSup Code script container|JavaCode script] and even from [JSup Math code|Math code]. It can reduce code duplication when some piece of code is needed from many script. A JavaCode function can be defined in the following three scope: * '''Shared domain''': from [JSup Application properties] dialog / ''Shared code'' or with ''Alt+Shift+S'' shortcut. A shared domain JavaCode function can be included (duplicated, using the ''Include in user domain also'' flag) in User [JSup domains|domain] also (keep in mind that is duplicated, so static definitions will be different objects/classes); otherwise a shared domain JavaCode function can be accessed from Shared domain code only. * '''User domain''': from [JSup Application properties] dialog / ''User code'' or with ''Alt+Shift+U'' shortcut. A user domain JavaCode function can be accessed from User domain scripts / code, that includes window code. * '''Window''': from the [JSup Window property dialog|Window property dialog] in the ''JavaCode funct.'' tab. A window JavaCode function can be accessed from the [JSup graphic windows|window] itself. Here is an example of a JavaCode function definition dialog: ((([img:///img/JSup/JavaCodeFunction-example1.png|margin=10|width=400|]))) * '''Function name''': the name of the JavaCode function. If you enclose a name in '''curly brackets''' than the name will be only a reference in the JavaCode function list and the entered code will not be enclosed in a Java static function, but directly inserted in the class that will include all the scope Java code translated from JavaCode. It's usefull '''to define class'''(es) instead of function, such class will be accessible from the JavaCode scope. * '''Return type''': the type of value that the function will return, use void if no return value will be provied, or enter a Java native time or a class name. For ''curly brackets'' JavaCode function leave this field blank. * '''Parameters''': the type and name of the parameters that the JavaCode function will accept. Enter the part withing round brackets of a Java function/method definition. For ''curly brackets'' JavaCode function leave this field blank. * '''Throws''': if the JavaCode function can throw exceptions of some type, enter their type here (separated by commas). The most common type of exception a JavaCode function could throw is JException that is thrown by many internal JavaCode methods when it access [JSup tag|tag] or other JSup objects. For ''curly brackets'' JavaCode function leave this field blank. * '''Comments''': an optional descriptive field that can be used to annotate the functionalities of the JavaCode function. * '''Function code''': the body of the JavaCode function definition. Here is an example of a '''curly brackets''' JavaCode function that defines a class and methods, like a library: ((([img:///img/JSup/JavaCodeFunction-example2.png|margin=10|width=400|])))