Sorry.
is from lemur doc (styling).
Here’s my Interface/styles/MyStyle.groovy
import com.simsilica.lemur.*;
import com.simsilica.lemur.Button.ButtonAction;
import com.simsilica.lemur.component.*;
def gradient = TbtQuadBackgroundComponent.create(
texture( name:"/Interface/icons/bordered.png",
generateMips:false ),
1, 1, 1, 126, 126,
1f, false );
def border = TbtQuadBackgroundComponent.create(
texture( name:"/Interface/icons/border.png",
generateMips:false ),
1, 1, 1, 6, 6,
1f, false );
def border2 = TbtQuadBackgroundComponent.create(
texture( name:"/Interface/icons/border.png",
generateMips:false ),
1, 2, 2, 6, 6,
1f, false );
selector( "MyStyle" ) {
fontSize = 14
}
selector( "label", "MyStyle" ) {
insets = new Insets3f( 2, 2, 0, 2 );
color = color(255, 0, 0, 0.85)
}
selector( "container", "MyStyle" ) {
background = gradient.clone()
background.setColor(color(255, 0, 0, 0.5))
}
selector( "slider", "MyStyle" ) {
background = gradient.clone()
background.setColor(color(255, 0, 0, 0.5))
}
def pressedCommand = new Command<Button>() {
public void execute( Button source ) {
if( source.isPressed() ) {
source.move(1, -1, 0);
} else {
source.move(-1, 1, 0);
}
}
};
def stdButtonCommands = [
(ButtonAction.Down):[pressedCommand],
(ButtonAction.Up):[pressedCommand]
];
selector( "title", "MyStyle" ) {
color = color(255, 0, 0, 0.85f)
highlightColor = color(255, 0, 0, 0.85f)
shadowColor = color(0, 0, 0, 0.15f)
shadowOffset = new com.jme3.math.Vector3f(2, -2, -1);
background = new QuadBackgroundComponent( color(255, 0, 0, 0.5) );
buttonCommands = stdButtonCommands;
}
selector( "button", "MyStyle" ) {
background = gradient.clone()
color = color(255, 255, 255, 0.85f)
background.setColor(color(255, 0, 0, 0.5))
insets = new Insets3f( 2, 2, 2, 2 );
buttonCommands = stdButtonCommands;
}
selector( "slider", "MyStyle" ) {
insets = new Insets3f( 1, 3, 1, 2 );
}
selector( "slider", "button", "MyStyle" ) {
background = doubleGradient.clone()
background.setColor(color(255, 0, 0, 0.5))
insets = new Insets3f( 0, 0, 0, 0 );
}
selector( "slider.thumb.button", "MyStyle" ) {
text = "[]"
color = color(255, 0, 0, 0.85)
}
selector( "slider.left.button", "MyStyle" ) {
text = "-"
background = doubleGradient.clone()
background.setColor(color(255, 0, 0, 0.5))
background.setMargin(5, 0);
color = color(0.6, 0.8, 0.8, 0.85)
}
selector( "slider.right.button", "MyStyle" ) {
text = "+"
background = doubleGradient.clone()
background.setColor(color(255, 0, 0, 0.5))
background.setMargin(4, 0);
color = color(0.6, 0.8, 0.8, 0.85)
}
selector( "checkbox", "MyStyle" ) {
def on = new IconComponent( "/Interface/icons/flatred-check-on.png", 1f,
0, 0, 1f, false );
on.setColor(color(0.5, 0.9, 0.9, 0.9))
on.setMargin(5, 0);
def off = new IconComponent( "/Interface/icons/flatred-check-off.png", 1f,
0, 0, 1f, false );
off.setColor(color(0.6, 0.8, 0.8, 0.8))
off.setMargin(5, 0);
onView = on;
offView = off;
color = color(0.8, 0.9, 1, 0.85f)
}
selector( "rollup", "MyStyle" ) {
background = gradient.clone()
background.setColor(color(0.25, 0.5, 0.5, 0.5))
}
selector( "tabbedPanel", "MyStyle" ) {
activationColor = color(0.8, 0.9, 1, 0.85f)
}
selector( "tabbedPanel.container", "MyStyle" ) {
background = null
}
selector( "tab.button", "MyStyle" ) {
background = gradient.clone()
background.setColor(color(0.25, 0.5, 0.5, 0.5))
color = color(0.4, 0.45, 0.5, 0.85f)
insets = new Insets3f( 4, 2, 0, 2 );
buttonCommands = stdButtonCommands;
}
And com/mystyle/mygame/StyleTest.java
package com.mystyle.mygame;
import com.jme3.app.SimpleApplication;
import com.simsilica.lemur.Button;
import com.simsilica.lemur.Command;
import com.simsilica.lemur.Container;
import com.simsilica.lemur.GuiGlobals;
import com.simsilica.lemur.Label;
import com.simsilica.lemur.style.BaseStyles;
public class StyleTest extends SimpleApplication {
public static void main( String... args ) {
StyleTest main = new StyleTest();
main.start();
}
@Override
public void simpleInitApp() {
// Initialize the globals access so that the defualt
// components can find what they need.
GuiGlobals.initialize(this);
// Load the 'glass' style
BaseStyles.loadStyleResources("Interface/styles/MyStyle.groovy");
// Set 'glass' as the default style when not specified
GuiGlobals.getInstance().getStyles().setDefaultStyle("MyStyle");
// Create a simple container for our elements
Container myWindow = new Container();
guiNode.attachChild(myWindow);
// Put it somewhere that we will see it
// Note: Lemur GUI elements grow down from the upper left corner.
myWindow.setLocalTranslation(300, 300, 0);
// Add some elements
myWindow.addChild(new Label("Hello, World."));
Button clickMe = myWindow.addChild(new Button("Click Me"));
clickMe.addClickCommands(new Command<Button>() {
@Override
public void execute( Button source ) {
System.out.println("The world is yours.");
}
});
}
}
What’s the mistake I made?