title: Is the AccessibleContext really a Java Object reference?
body: <p>I am able to use WindowsAccessBridge.dll to get access to java window (SwingSet2), and use the dll methods to interact with the controls.
  I can iterate the tree (of java controls) using code shown <a href="https://community.oracle.com/message/5463279" rel="nofollow noreferrer">here</a>,  and get information from the controls,
  and I can do actions like SetText in Text box, or send click action to a button etc.</p>
  
  <p>However, I am finding that the accessibility contexts are not consistent:
  The SetText method works perfectly when I use the accessibility context got from the 'setMousePressedFP' method of the dll, after clicking on the text box.</p>
  
  <p>However, I cant use the accessibility context got by iterating the control tree when trying to set text in a text box, although I verified that the other information e.g. size and other properties of the text box is same.</p>
  
  <p>From <a href="https://docs.oracle.com/javase/accessbridge/2.0.2/api.htm" rel="nofollow noreferrer">this doc</a>:</p>
  
  <blockquote>
    <p>"The functions GetAccessibleContextAt and
    GetAccessibleContextWithFocus retrieve an AccessibleContext object,
    which is a magic cookie (really a Java Object reference) to an
    Accessible object and a JVM cookie. "</p>
  </blockquote>
  
  <p>However, the accessibility context differs everytime I click on the text box (without restarting the java program). The vmID matches eveytime.
  If the AccessibleContext is really a Java Object reference, shouldnt I get the same AccessibleContext number everytime I click on the same control (without restarting the java window) ? and shouldnt that AccessibleContext number also be available in the tree?</p>
  
  <p>Worst part is that the settext method doesnt work when I use the AccessibleContext got from iterating the control tree.</p>
  
  <p><strong>Edit to clarify the question further:</strong></p>
  
  <p>I am clicking on the same text box, so I would expect the windowsaccessdll function to return reference to the same control. As a long value the accessibeContext is different everytime I click, but its ok as the SetText method works everytime with the different long values and I can see the new text set in the text box.
   The problem is when I iterate the control tree and the accessibility context got from the tree iteration doesnt work for the SetText method.
  More specifically - how does the AccessibleContext compare to a c pointer - the c pointer would always be same when I get it for a specific control. The AccessibleContext appears to be a 8 digit long value that is different by few tens or hundreds based on where the mouse is clicked inside the text box. </p>
  
  <p>Thanks in Advance.</p>