Change the background and icon color of the Dropdown Component's button:

I have figured out a better way of doing this. Instead of targeting the button, the new method changes the background of the text area and dropdown menu without effecting the button or the border. Therefore, the button color is still controlled by the traditional background property while the rest of the component is changed through scripting by replacing the dropdown's cell renderer with a custom renderer.

Here is the result:


Here is the script:

#on the dropdown's propertyChange event handler
if event.propertyName == "componentRunning":
	from javax.swing import DefaultListCellRenderer
	from java.awt import Color
	class ColorCellRenderer(DefaultListCellRenderer):
		def getListCellRendererComponent(self, list, value, index, isSelected, cellHasFocus):
			component = DefaultListCellRenderer.getListCellRendererComponent(self, list, value, index, isSelected, cellHasFocus)
			if cellHasFocus or isSelected:
				component.background = event.source.selectionBackground
				component.background =
			component.foreground = Color.white
			return component
	renderer = ColorCellRenderer()
1 Like