Access to the Java Object Layer
The GUIKit framework provides Wolfram Language functions, such as PropertyValue[{"widgetName","propertyName"}], for accessing state or calling methods on JavaObject instances using InvokeMethod[{"widgetName","methodName"},arguments]. However, this does not prevent you from using the standard J/Link techniques for manipulating any underlying JavaObject that makes up the runtime interface.
Needs["GUIKit`"];ref = GUIRun[
Widget["Panel", {
Widget["Label", {"text" -> "Hello World!"}, Name -> "myLabel"]
} ]
]Here is what this interface will display as on a typical platform.
GUIScreenShot[ ref]The first argument of a GUIObject is the root window Java class, in this case a javax.swing.JFrame instance. You can make method calls on this component while the interface is running.
First[ref] @ isVisible[]First[ref] @ setTitle["Test"]Here is the user interface now. (The interface has been resized to display the entire title.)
GUIScreenShot[ ref]WidgetReference[] looks up specially registered instances; such utility GUIObject functions also return JavaObject instances, and so any object in the interface can be accessed directly with J/Link method calls.
l = ref @ WidgetReference["myLabel"]l @ setText["new label"]Here is the user interface now.
GUIScreenShot[ ref]