To make the above example more specific to this post, I developed it a little further, so the code only affects the header.
Here is the code:
from java.awt import Color
from com.jidesoft.swing import TristateCheckBox, JideScrollPane
from com.inductiveautomation.factorypmi.application.components import AlarmTableHeader
#==============================
#Define Colors
headerBackground = Color.blue
headerForeground = Color.white
checkboxColor = Color.white
#==============================
def setHeaderStyle(alarmStatusTable):
if alarmStatusTable.componentCount > 0:
for component in alarmStatusTable.getComponents():
if isinstance(component, TristateCheckBox):
component.background = checkboxColor
if isinstance(component, AlarmTableHeader) or isinstance(component, JideScrollPane):
component.background = headerBackground
try:
component.getTableHeader().setOpaque(False)
component.getTableHeader().foreground = headerForeground
except:
pass
try:
corner = component
corner_Field = corner.getClass().getDeclaredField('corner')
corner_Field.setAccessible(True)
corner_Value = corner_Field.get(corner)
graphics = corner_Value.createGraphics()
graphics.setPaint(headerBackground)
graphics.fillRect (0, 0, corner_Value.getWidth(), corner_Value.getHeight())
except:
pass
setHeaderStyle(component)
alarmStatusTable = event.source.parent.getComponent('Alarm Status Table')
setHeaderStyle(alarmStatusTable)
Here is the result:
