How to make a centered label with Icon?


What is blackColor? What is fontFQ26?

…usually what I’d do to debug this is comment attributes out to see what’s causing the issue.


The issue is the background. If I remove it, then the label is drawn as specified; otherwise the Label is not visible.

Maybe the background is drawn on top of the Label?


That would depend on how the background is defined… which I also can’t see.

def defPinkBackground = TbtQuadBackgroundComponent.create(
texture( name:"Interface/ui-menu-button-pink.png",
        generateMips:false ),
        1f, 50, 0, 100, 68,
        0f, false);


Try giving it an offset other than 0. It’s probably sitting right at the exact same Z… but still I’d expect the text to sort on top.

I think the glass style uses some Tbt quad components if you want to see some working examples.


Indeed that solved my issue!

def defPinkBackground = TbtQuadBackgroundComponent.create(
texture( name:"Interface/ui-menu-button-pink.png",
        generateMips:false ),
        1f, 50, 0, 100, 68,
        1f, false);

Wait, isn’t it now on top of Label? Oh well…

Now to the next issue: Container is good for layout, but also takes over the Focus management. I’d like to use bigbanana 4-way navigation; is there a way to tell Container to not manage the focus?


a) I’m pretty sure there is a way to replace the focus root behavior but I don’t remember exactly what off the top of my head. (no time to look at the moment)

b) what does 4 way navigation mean in a vertical stack of buttons?


Looking forward to this one. Please post findings.

I have an issue where the container (at least I suspect that to be it) grabs focus when using arrow keys.


If you don’t want any focus management at all then you can just shut it off by deactivating the function group:


It does matter for table-like layout, like this:

<save slot 1>  <delete>
<save slot 2>  <delete>
<save slot 3>  <delete>
<back to main menu>


Thank you. Fixed.


In order to 4-way navigation to work with pre-existing component, it is necessary to add to them a Control which implements BBFocusTarget

The methods to implement are onFocusGain() and onFocusLost(). These method should update the status and the visuals of the Component so that it receive and lose focus respectively. Is there a way to do something like Button.receiveFocus()?


You mean like this:


Is it possible to define an alternate style for “disabled” look?




The built in GUI elements don’t really have a concept of “disabled”, I guess.

I’ve faked it before by adding a component to the element that I wanted to disable. This component was essentially a semi-transparent gray box that swallowed mouse events… offset in such a way that it was on top of the rest of the GUI element.

To be honest, if I ever add “official” support then it would probably also be something like that.


I ended up with this

public class AButton extends ActionButton {

    public AButton(Action action) {

    public void setEnabled(boolean enabled) {
        ColorRGBA c = ColorRGBA.Gray;
        if (enabled) {
            c = getColor();
        ((TbtQuadBackgroundComponent) getBackground()).setColor(c);

To make it work properly, I’d need to read the color I’ve defined on the groovy. How can I do that?

Also the highlight background won’t respect this. Is there a way from groovy to reference the code written here?


:banana: :banana: :banana: :slight_smile:


The real issue is that enabled/disabled was not added as button actions. So probably any option you have will be a bit of a hack until that’s supported.

You can’t “read the color from groovy” but you could potentially “let groovy set it for you” by defining an actual property on AButton and marking it with the StyleAttribute annotation.

I thought about this a few different ways but I’m still not sure what you are trying to ask.

Is the button being highlighted even when it’s disabled? Is that your code doing it or mine?

#105 looks like it (correctly) won’t even call highlight on or off if the button is disabled: