[Solved]Lemur - padding button text

Pardon me if I’m missing something obvious, but I’ve spent a few hours on this and haven’t managed to find a solution.

I’m working on building a windowing system on top of Lemur, and of course every window has got to have a close button. As a first prototype, my close button is denoted with the text label “X” in lieu of a proper icon. The trouble is that right now my close button looks something like this: [X]. The text is very crowded against the sides of the button, so I’d like to force a little extra padding between the sides of the button and the text so that it looks more like this: [ X ]. I can do that by sticking space characters onto the left/right of the X character, but this is rather crude and doesn’t give any kind of fine-grained control at all.

What’s the “right” way to do this in Lemur?

I believe you set the insets on the background component.

Something like…

((TbtQuadBackgroundComponent)button.getBackground()).setInsets(new Insets3f(5,5,5,5);

It’s the margin of the background component… but the approach is essentially the same as jayfella mentions.

There are a variety of ways… but that is probably the easiest/simplest. If you have no background on that particular button then you can set the button insets… but it affects the border/background, too… since the insets are outside of it.

Easiest is to do it with the background or border component margins.

Thanks for the quick responses.

I was wondering about the background margin/insets, but I wanted to avoid relying on specific types of background components since those can be set in styling and could change.

I’m thinking that it’s just time to roll my own style - the Glass style sets the margins, and that task can be done safely from within the style file without my Java code restricting what type(s) of backgrounds can be used on that button.

Thanks for the help!