Ask a Question

How do I get the x y coordinates of a java swing table cell?

SOLVED
hogueybear
Occasional Contributor

How do I get the x y coordinates of a java swing table cell?

Just wondering if there is a way to get the x y coordinates of a cell in a java swing table, using jscript?

4 REPLIES 4
Colin_McCrae
Community Hero

Do you have access to the developers? They are quite possibly the people to ask?

 

A quick google got me this:

 

http://docs.oracle.com/javase/7/docs/api/javax/swing/JTable.html#getCellRect(int,%20int,%20boolean)

 

... which looks like it might return/contain the type of info you're after? (heights, x/y's, etc) Not sure if they are absolute coordinates or relative to the container grid though.

TanyaYatskovska
SmartBear Alumni (Retired)

Hi,

 

In addition to @Colin_McCrae’s reply, I recommend that you read the Accessing Native Methods of Java Objects article describing how to work with native Java methods and properties in TestComplete.

 

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



Yep. That may well be the case.

 

It sounds very similar to rhe "RECT" property of a TreeView Node object in Delphi. I need to use those to get co-ordinates relative to the tree container in order to apply a click to a custom checkbox.

 

But the RECT property is only available via the debug agent (in Delphi land). So what Tanya is saying makes sense to me.

hogueybear
Occasional Contributor

The Rectangle method worked to get me the x,y coordinates.  Thanks

cancel
Showing results for 
Search instead for 
Did you mean: