def main():
startApplication("my_aut")
#...
jtable = waitForObject({"type": "javax.swing.JTable"})
# This is an instance of javax.swing.plaf.ColorUIResource
# https://docs.oracle.com/javase/8/docs/api/javax/swing/plaf/ColorUIResource.html
background = get_jtable_cell_background(jtable, 0, 0)
test.compare(255, background.getRed())
def get_jtable_cell_foreground(jtable, row, column):
component = get_jtable_cell_component(jtable, row, column)
return component.getForeground()
def get_jtable_cell_background(jtable, row, column):
component = get_jtable_cell_component(jtable, row, column)
return component.getBackground()
def get_jtable_cell_component(jtable, row, column):
renderer = jtable.getCellRenderer(row, column);
value = jtable.getModel().getValueAt(row, column)
selectedColor = jtable.getSelectionModel().isSelectedIndex(row)
hasFocus = True
component = renderer.getTableCellRendererComponent(jtable, value, selectedColor, hasFocus, row, column)
return component