Comsol App development is based on Java because the comsol is built by Java. I am not familiar with Java. Here is some basic skill for Java.
Data type changes
Java is a static program language. The variables must be defined as a type before it is used. There is a static method for each type to accept another type. For example:
String str="1.234";
Int.valueOf(str); //Change string to int.
There are two ways to change numbers to string.
double a=1.234;
String.valueOf(a); //This is the general way.
""+a;//Special way.
Variable share
It is always necessary to exchange information between the GUI and the APP.
model.result("pg1").getString("looplevel");//Get the parameters of a plot.
model.param().evaluate("m"); //Get the parameters of the project.
fq = model.result().table("tbl1").getReal(); //Get the table value.
Please note that all the parameters of the project are visible in the result after a study is finished. However, the parameters will not change after the study is finished. So it is not possible to sent message to the GUI through parameters. The string for the input box in the GUI can be change in the code directly.
model.result("pg2").feature("lngr1").set("expr", "abs(emw.Hz)/"+maxHz[Integer.parseInt(model.result("pg1").getString("looplevel"))-1]);