Label margin/padding inside its border?

I have a left-aligned label with some text, a white background and a black line border.
http://screencast.com/t/kPfbNz1kux

The text is pretty close to the border, making it a little harder to read. Is there a way to change the margin or padding of the label? In other areas, I’ve centered my label to make it look better, but in this case I need it left-aligned.

I know I can create a template with a rectangle and a label to achieve the same effect or turn my text into an expression and append a space on the front. I’m looking for something less cumbersome (more like a setting that I’m apparently not able to see) :slight_smile:

Thoughts?

Hello,
You could put the following code in the propertyChange script of the label:

if event.propertyName == "componentRunning": from javax.swing import BorderFactory label = event.source paddingBorder = BorderFactory.createEmptyBorder(0,5,0,0) border = BorderFactory.createCompoundBorder(label.border,paddingBorder) label.border = border Note that you will only see the results of this code in a client and not in a designer because this code only runs in a client.

Best,

1 Like