Need to check color/font style of java table (text, background) in Swing application cause style of row should depend on a column value.

styled jTable

It is possible to get color of font and background of selected (cell/row):

mainTable.selectCell(0, 0);
String bgcol = mainTable.getSelectionBackground().toString();  // => javax.swing.plaf.ColorUIResource[r=51,g=153,b=255]
String fgcol = mainTable.getSelectionForeground().toString();  // => javax.swing.plaf.ColorUIResource[r=255,g=255,b=255]    

But selected cell/row has its own style of selection, so this check becomes quite useless.

What is the way to accomplish style checking of any cell/row (not just selected) with Jemmy library?

1 Answer 1


A renderer is used to paint each cell in the table. Code to access the component used to render the cell:

TableCellRenderer renderer = table.getCellRenderer(row, column);
Component c = table.prepareRenderer(renderer, row, column);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.