Vision Numeric Text Field underlined text

Got it:

if event.propertyName in ('componentRunning'):
	from java.util import HashMap
	from java.awt.font import TextAttribute
	
	fontAttributes = HashMap()
	fontAttributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON)
	
	obj = event.source
	obj.setFont(obj.getFont().deriveFont(fontAttributes))

Edit: worth noting that to turn it off, there’s no corresponding “UNDERLINE_OFF”. Simply set it to -1.

8 Likes