Relatively scaling templates with internally anchored layout?

Quick question that’s been plaguing me. Is there a good way to relatively scale templates that use anchored layouts?

I use a number of templates for things like pre-formatted numeric labels and text. These templates generally all use anchored scaling, allowing me to resize depending on the content shown. E.g. the following use the same templates, but are horizontally stretched to fit more characters:

Ideally I would set the template instances to use relative scaling, and have the object and text scale up/down with respect to the instance’s size. Here’s what I have in my designer:

Compare that to what’s shown in my Vision runtime (Vision application/monitor are larger than the window in the designer). Note that the template itself scaled (larger borders on templates), but the text is the same size as in the designer.

To summarize, is there a way to get the perks of both anchored layout within my templates AND relative layout in my window?

Relative sizing is all or nothing. If I understand clearly, what you are after is relative in the Y direction and anchored in X. You would need to scale your font based on runtime component height. You’d have to use a custom Swing listener for that, I think.

Thanks for the input Phil. It’s a case by case situation, but that’s generally the idea. For instance, I might have some templates (like my numeric label equivalent) that can only stretch in the X, whereas others (like my label equivalent) can stretch in the X or Y.

I’ll give the Swing approach some thought, though I’m a bit hesitant to add anything overly complex as this will eventually be a company template project. Thinking KISS principles may make sense here. I’ll think it over and update this post if I end up with some solution beyond making everything relative.