Set label border using event script


I need to modify the border color of a Label while in the event script of another component. I am trying to follow the example in Creating TitledPanel Border Object. I have been able to get it to work but I am trying to get it to look more like the results of this call to the toBorder method in the expression binding on a labels Border property toBorder("line;255,0,255,255;5"). I'm not sure if FieldBorder may be a better choice in this case. Can someone either point me in the right direction or show me a a working example of what I am trying to do?

Thanks in advance!

Probably something like this:

from javax.swing import BorderFactory
border = BorderFactory.createLineBorder(system.gui.color(255,0,255), 5)

BorderFactory has lots of static factory methods for standard Swing border types.

1 Like