import dstc.kalimantan.inspect.*;
public class Test extends Object
{
public static void main(String args[])
{
InspectorFrame.on("Hello sailor!");
}
}
Execution of this piece of code results in the inspector window shown below. The title of the window indicates the class of the object being inspected, in this case a String. As you can see, a String is not a primitive data type, but is rather composed of three other objects. On the left hand side is a list of the names of the instance variables of the object. The text area on the right hand side contains the string Hello Sailor, representing the contents of the object.
When one of the instance variables on the left is selected, the text area on the right is updated to reflect its contents, as shown below. The Inspector window executes in a separate thread and the instance variables are therefore subject to change. If the contents of that instance variable do change, the change will be reflected the next time the instance variable is displayed. It will not be automatically updated while you view it, but selecting and deselecting the instance variable name will force an update.
The Back and Forward buttons along the bottom can be used in a style that will be familiar to users of web browsers. The Forward button will inspect the selected instance variable, replacing the current list of instance variables with the instance variables of the of that object. The Inspector keeps track of which objects have been inspected, and so pushing the Back button returns you to the object you were previously inspecting. The Spawn button will create a new Inspector window on the selected object, which is useful when you wish to compare several different fields. And finally, the Close button will make the window go away, which is quite handy after you've spawned 300 of these things.
If you're interested in extending the Inspector, the api documentation is available here.
Ted Phelps
<phelps@dstc.edu.au>