#AdditionalJar: java-barcode-2.0.3
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private ImageView1 As ImageView
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("1") 'Load the layout file.
Dim img As Image = CreateDataMatrix("testing 1 2 3")
ImageView1.SetLayoutAnimated(0, ImageView1.Left, ImageView1.Top, img.Width, img.Height)
ImageView1.SetImage(img)
MainForm.Show
End Sub
Sub CreateDataMatrix(value As String) As Image
Dim factory As JavaObject
factory.InitializeStatic("com.barcode_coder.java_barcode.BarcodeFactory")
Dim barcode As JavaObject = factory.RunMethod("createBarcode", Array("Datamatrix", value))
Dim f As String = File.Combine(File.DirTemp, "1.png")
barcode.RunMethod("export", Array("png", 10, 50, True, f))
Return fx.LoadImage(f, "")
End Sub