### Inline Java Get and Set Field

This is an example of defining a field in Inline Java and get / set the value of that field.
Field version is defined in the Inline Java Code as public static Integer version = 2;
`Sub Process_Globals
Private joInlineJava As JavaObject = Me
End Sub`
`Sub AppStart (Form1 As Form, Args() As String)
'Read the value of field version
Dim version As Int = joInlineJava.GetField("version")
'Show the value of field version
joInlineJava.RunMethod("InformationDialog", Array("Information Dialog My Title", "My Header", "Field Value for Version" & CRLF & version))
'
'Set a new value for field version
joInlineJava.SetField("version", 23)
'Read and show the value of field version
Dim version As Int = joInlineJava.GetField("version")
joInlineJava.RunMethod("InformationDialog", Array("Information Dialog My Title", "My Header", "Field Value for Version" & CRLF & version))
End Sub`
if JAVA
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.*;
import javafx.stage.*;
public static Integer version = 2;
public static void InformationDialog(String mtitle, String mheader, String mcontent) {
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle(mtitle);
alert.setHeaderText(mheader);
alert.setContentText(mcontent);
alert.showAndWait();
};

Changed: , Category: Inline Java, File: T6C201M1475.htm, ID: 1475