Sub showImage(img As JavaObject)
Dim h, w As Int
h = img.RunMethod("getHeight",Null)
w = img.RunMethod("getWidth",Null)
Dim frame, label, imageicon As JavaObject
frame.InitializeNewInstance("javax.swing.JFrame",Null)
frame.RunMethod("setSize",Array(w,h+50)) ' allow for title bar
label.InitializeNewInstance("javax.swing.JLabel",Null)
imageicon.InitializeNewInstance("javax.swing.ImageIcon",Array(img))
label.RunMethod("setIcon",Array(imageicon))
frame.RunMethod("setTitle",Array("The picture"))
frame.RunMethod("add",Array(label))
frame.RunMethod("setAlwaysOnTop",Array(True))
frame.RunMethod("setVisible",Array(True))
frame.RunMethod("setDefaultCloseOperation",Array(frame.GetFieldJO("DISPOSE_ON_CLOSE")))
End Sub