Ask a Question

Comparing image in Jtable

Occasional Contributor

Comparing image in Jtable

I have Jtable with rows and columns, The Image icon is Stop (red colour) and Go green colour.

I want to click the row only when the particular cell has green icon.

I am using Testcomplete/javascript 

Application is desktop using java.

Anyone has done this before?
SmartBear Alumni (Retired)

Hi Zaheer,


The pseudocode of the comparison function can look like this:

// get the cell with the image by its row and column

var cell = ...


// save the currently displayed icon

var curImage = cell.Picture() 


// get the image for the comparison. It can be stored in Stores

var desiredImage = Regions.GetPicture("StoredImageName") 


// compare if the current and the desired images are the same

if (curImage.Find(desiredImage)


  Log.Message("The cell contains the desired icon")



I suggest that you read the "Finding an Image Within Another Image" article for details.


Tanya Yatskovskaya
SmartBear Community and Education Manager

Occasional Contributor

Hi Tanya, Thanks for reply.

I tried to get the cell with the image value for column/row using following code

var cell = table.getCell(row, column) / var cell =table.getvalueAt(row, column)

I dont get any value back hence the next statment

var curImage = cell.Picture()


Do you have any idea how do i get cell witht the image by its row and column.


Showing results for 
Search instead for 
Did you mean: