Where to find an overview of all Lemur styling classes

Is there a place where I can find an overview of every styling class for every stylable component?

I am now trying to style the Selector component - which is the dropdownbox. And currently it looks like this:

My current styling script looks like this:

// -----------------------------------------------------------------------------
// SELECTOR
// -----------------------------------------------------------------------------

selector( "selector.container", "ungatest" ) {
    color = color(0.961,0.984,0.976,1.0)  
    background = gradient.clone()
    background.setColor(color(0.6,0.639,0.635, 0.9))
    fontSize = 16
}
selector( "selector.label", "ungatest" ) {
    insets = new Insets3f( 2, 2, 0, 2 );
    color = color(0.961,0.984,0.976,1.0)  
    background = gradient.clone()
    background.setColor(color(0.6,0.639,0.635, 0.9))
    fontSize = 16
}

selector.containers seems to style the background of the component. selector.label does not do anything, I think.
However, container does allow me to set a size that is lesser than it shows here. I have tried
preferredSize = new com.jme3.math.Vector3f(100, 10, 1) but it stays this size.

I also want to style the background of the options-list which currently does not have a background.

Look in the glass style for examples on what is likely what you want to set.

Otherwise, the javadoc will tell you which attributes are stylable because they will have the StyleAttribute annotation.

There is no single full list because it would depend on the classes available to you and what custom attributes you may have added StyleAttribute annotations to yourself.

re: preferred size, the only way to set the preferred size is at runtime.

Found more glass style files. That helps.

I did not find any example of how to style buttons. Maybe that just isn’t possible?

There is just one @StyleAttribute annotation on the Selector-page.

I did learn that the slider can be styled using the slider styling. Which should have been obvious…

But I don’t see how to style the highlighted buttons and options.

And I used setPreferredSize on the selector. It works for the width, but the height won’t go any lower then it is on the image above.

A Button is a Label which is a Panel. Everything you can do on Panel, you can do on Label. Everything you can do on Label, you can do on Button.

But it extends container which extends panel.

This part could be better documented but generally the children of a composite GUI element follow a certain naming convention. So whatever the parent is there will be dotted children and they try to always end with what they actually are (.label, .button, etc.) so that they pick up the default styling for those.

So find out actual child names, unfortunately you have to look at the top of the .java files.

It’s just a ListBox so whatever styling works for ListBox will work for selector.list… etc.

The selector’s list box has a visible items (maybe not stylable) that can be set. it is likely overriding (or appearing to if you have no background set) the preferred size.

If I am reading the code right, ListBox is used for the popup list - that one I have under control.

It is the default appearance in the menu. If I am not mistaking, that part has the ID ‘item’. When there is no popup. I have tried forcing every part to a preferendSize, but nothing helps to get the lowest row - or any other - getting any less high.

        // Lowest row: Fittness-dropdown
        l=new Label("Fittness ");
        l.setTextHAlignment(HAlignment.Left);
        l.setPreferredSize(new Vector3f(60,10,1));
        buttonSets.addChild(l);
        SpringGridLayout g=new SpringGridLayout(Axis.X, Axis.Y);
        Container c= new Container(g);
        c.setPreferredSize(new Vector3f(240,10,1));
        buttons = buttonSets.addChild(c, 1);
        buttons.setPreferredSize(new Vector3f(240,10,1));
        VersionedList<String> testList = enumToVList(StatsData.COUNTERS.class);
        Selector lb=new Selector(testList, "ungaTest");
        lb.setSelectedItem("New_leader");
        lb.setPreferredSize(new Vector3f(240,10,1));
        controls.put("EVO_Fittness", (Panel)lb);
        buttons.addChild(lb);

image

I’m clearly failing to understand what you are asking. I need a diagram with big red arrows, I think.

1 Like

image
Here you are.

My main concern for now is the selector field at the bottom (red arrow). It is two font-heights high. Just one would be nice.

But as you may notice, the other two rows are also way too high (yellow arrows).

My only guess is that the outer container is stretching them because it’s been forced to be too high for the things in it. If you want the outer panel big for other reasons then you can change its layout’s fill mode for the y direction to he FillMode.Last and add an empty label at the bottom that will stretch to fill the rest.

1 Like

That worked… the top container did not have a SpringGridLayout, I put one in and set FillMode to None.

Please remind me to put you up for a Noble Prize.

4 Likes