Creating a Fixed Watch

If a variable is assigned a watch, you can create a fixed watch from it. Whereas a normal watch describes the content of a variable, a fixed watch describes the object that is currently assigned to the variable.

For example, consider the following code:

java.awt.Dimension dim=new java.awt.Dimension(10,20);
java.awt.Dimension newDim=dim;
dim=new java.awt.Dimension(20,30);
newDim.height=15
With the debugger stopped on the second line, you can create a normal watch on the variable dim. If you then create a fixed watch on this variable, it is created on the object that is currently assigned to the variable, which is java.awt.Dimension(10,20)). If you press F8 to step over the code three times, the value of the normal watch becomes java.awt.Dimension(20,30). (This change occurred on the third line of source code.) The value of the fixed watch is java.awt.Dimension(15,20). The fixed watch was created on the object with a height of 10, but the fourth line changed the height of this object to 15.

To set a fixed watch:

  1. In the Watches pane of the Debugger window, select the watch.

  2. Right-click and choose Create Fixed Watch.

    A new node appears in the Watches pane and shows the current value of the watch variable or expression.
You can also create a fixed watch on a variable in the Variables pane. Select the variable, right-click, and choose Create Fixed Watch.
See also
Watching the Value of a Variable or Expression
Deleting a Watch Variable or Expression

Legal Notices