I figured out how to change the caret color for the underlying JTextArea of a PMITextArea but it seems like there is probably a better or cleaner way to do this.
What is a better way to do this?
text_area = event.source.getComponent("Text Area Whatever")
children = text_area .getComponents()
for child in children:
if type(child).__name__ == "JViewport":
vpChildren = child.getComponents()
for vpChild in vpChildren:
if type(vpChild).__name__ == "JTextArea":
vpChild.setCaretColor(java.awt.Color.green)
You don’t need to loop through everything. You can just do the following:
from java.awt import Color
area = event.source.parent.getComponent("Text Area")
area.viewport.view.setCaretColor(Color.green)
Hope this helps.
Also, in the future this sort of post might be better fit for the Ignition Design Help area.
[quote=“dave.fogle”]You don’t need to loop through everything. You can just do the following:
from java.awt import Color
area = event.source.parent.getComponent("Text Area")
area.viewport.view.setCaretColor(Color.green)
Hope this helps.
Also, in the future this sort of post might be better fit for the Ignition Design Help area.[/quote]
Thanks! That’s exactly what I was looking for.