### Inline Java UI HelloWorld

B4J UI Application - Inline Java Example HelloWorld to Log.
Example B4J Project
'UI application
Region Project Attributes
#MainFormWidth: 600
#MainFormHeight: 400
End Region
`Sub Process_Globals
Private fx As JFX
Private nativeMe As JavaObject
End Sub`
`Sub AppStart (Form1 As Form, Args() As String)
nativeMe = Me
'Show string hello world in the log
nativeMe.RunMethod("HelloWorldToLog", Null)
'Return string hello world and show in the log
Dim s As String = nativeMe.RunMethod("HelloWorldReturn", Null)
Log(s)
'Show string as parameter in the log
nativeMe.RunMethod("HelloWorldParameter", Array("Hello world!"))
End Sub`
'Log string hello world to the log
If JAVA
public static void HelloWorldToLog() {
BA.Log("Hello world!");
System.out.println("Hello world!");
}
End If
'Return string from the java method
'Function must be a static method
If JAVA
public static String HelloWorldReturn() {
return "Hello world!";
}
End If
'Log string as parameter
If JAVA
public static void HelloWorldParameter(String s) {
BA.Log("Hello world!");
System.out.println(s);
}
End If

Changed: , Category: Inline Java, File: T6C201M1482.htm, ID: 1482