### HelloWorld (Inline Java UI Dialog)

Since B4J 2.80 Inline Java can be embedded in B4x Apps.
Reference: http://www.b4x.com/android/forum/threads/inline-java-code.50141/
The idea
B4J UI Apps run in full screen mode and very slow on the Raspberry Pi.
In exploring alternatives, thought about creating an UI App based on a B4J Non-UI App.
The UI part build as Inline Java based on Swing dialogs.
Lets give a try with some examples to show how to create a B4J Non-UI App with an User Interface.
Running these samples on the Raspberry Pi is amaizingly fast.
Message Dialog HelloWorld
'Non-UI application (console / server application)
'B4J HowTo - Raspberry Pi B4J Non-UI Program showing a UI Swing Message Dialog
'B4J Additional Libraries: JavaObject
'Raspberry Test:
'Start the B4J Brige on the Raspberry Pi: sudo java -jar b4j-bridge.jar and connect from the B4J IDE to the bridge.
'Note: Recommend to create a dedicated folder for B4J on the Raspberry Pi, i.e. /home/b4j and install the B4J Bridge in that folder.
'Author: Robert W.B. Linn
'Version: 20180414
Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
End Region
`Sub Process_Globals
Private nativeMe As JavaObject = Me
End Sub`
`Sub AppStart (Args() As String)
'Run the inline java dialog
nativeMe.RunMethod("HelloDialog", Array("Hello World"))
'
StartMessageLoop
'Do not forget to close properly
ExitApplication2(0)
End Sub`
'Return true to allow the default exceptions handler to handle the uncaught exception.
`Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub`
' Show a swing message dialog UI in a B4J Non-UI app.
' Close the dialog by pressing the OK button.
If JAVA
import javax.swing.JOptionPane;
// Helloo Dialog called via the JavaObject
public static void HelloDialog(String msg) {
JOptionPane.showMessageDialog( null, msg );
}
End If

Changed: 2018-06-07 09:20, Category: Raspberry Pi Sample Projects, File: T6C238M1739.htm, ID: 1739