Hi all,
I want to change the font size of text in a template(there will be a button in the template), essentially by binding it to a custom property (Boolean type). Where can I script it? and how?
So in short, its changing the font size of text in a button, via scripting, based on value of the custom property.
Thanks
I am also trying to do this. I can change the text and name of a component with this code but when I try to change the font it errors with cannot convert to Java.Awt.Font.
event.source.parent.getComponent(compItem).font = “Elephant, Plain, 14”
If you want to change the font size, then use deriveFont
so you don’t need to construct a new instance yourself:
component = event.source.parent.getComponent(compItem)
component.font = component.font.deriveFont(14.0)
If you want to create a totally new font, then I would suggest importing and using java.awt.Font
directly:
from java.awt import Font
component.font = Font.decode("Elephant PLAIN 14") # or Elephant-PLAIN-14
3 Likes