You have to use a modified version of Lemur I’m working on called LemurDynamo. You can grab Beta3 from my Google Drive here: https://drive.google.com/open?id=0B6BscJ4Cq-K7ZUlJakxKZFRiTGs
I just uploaded it so the Advent theme is available. The reason I’m making themes is to give examples on how to use the new styling options. Aside from the Checkbox the Advent theme does not use any images, it uses GradientBackgroundComponents which work similar to styling buttons and such for Android or web pages. You define a radius for the corners, a border size and gradients for the inner portion and border portion. You can also rotate the border and/or inner gradients for diagonal designs.
When adding gradients to GradientBackgroundComponent you use the ColorStop class.
GradientBackgroundComponent.setInnerColors(new ColorStop(new ColorRGBA(1, 1, 1, 1), 0f), new ColorStop(new ColorRGBA(0, 0, 0, 1), 1f));
will produce a gradient on the interior of the background that fades from white at the bottom to black at the top. The second argument to ColorStop is the position of the color along the gradient. 0.0 is the bottom of the background, 1.0 is the top, 0.5 is the middle. When adding colors to the gradient you must add them in ascending order from 0.0 to 1.0 which is from bottom to top.
You can fade between up to 8 colors on the interior and 4 for the border. Don’t worry if you accidentally add more than 8 or 4, those will just be discarded. When adding border colors you must specify in the ColorStop that it is a border color by specifying true as the third argument to ColorStop:
BackgroundGradientComponent.setBorderColors(new ColorStop(ColorRGBA.Blue), 0.0, true);
produces a solid blue border so long as GradientBackgroundComponent.seBordertThickness()
is greater than 0, if not then the color doesn’t matter because there’s no border.
I haven’t gone through and commented GradientBackgroundComponent a whole lot yet. You can set the radius of the edges with GradientBackgroundComponent.setRadius()
and interior gradients can be radial with GradientBackgroundComponent.setRadialGradient(true)
there’s also GradientBackgroundComponent.setRadialGradientPos(float x, float y)
to set the center of the gradient circle, 0.5, 0.5 is the center of the background, and GradientBackgroundComponent.setRadialGradientScale(float x, float y)
to scale the inner gradient.
P.S. LemurDynamo requires all the normal Lemur dependencies plus jME-TrueTypeFont available on my site at http://1337atr.weebly.com/jttf.html
P.P.S. The radius of the corners will scale if the width/height of the resulting background is not large enough to accommodate the radius. For instance if you put in a radius of 10 and the resulting width/height of the background is 4x4 then the radius will scale down to 2, 2+2=4. If/when the background grows larger it will scale the radius back up until it it reaches 10. This helps for creating circles. If you want a circular edge just specify a large radius like 1000000.
Here’s an example. Once you get LemurDynamo up and running add the following to your simpleInitApp:
getViewPort().setBackgroundColor(ColorRGBA.White);
GuiGlobals.initialize(this);
BaseStyles.loadAdventStyle();
GuiGlobals.getInstance().getStyles().setDefaultStyle("advent");
Container myWindow = new Container(new VBoxLayout(5, FillMode.Even, false));
guiNode.attachChild(myWindow);
myWindow.setLocalTranslation(100, 450, 0);
ComboBox cb = new ComboBox();
cb.addItems("Item 1", "Item 2", "Item 3", "Item 4");
myWindow.addChild(cb, false, false);
DropDown dd = new DropDown("Drop Down");
dd.addItems(VBoxLayout.HAlign.Center, false, new Label("Define"), new Label("Individual Alignment"));
dd.addItem(new Label("1"), VBoxLayout.HAlign.Left, false);
dd.addItem(new Label("2"), VBoxLayout.HAlign.Right, false);
dd.addItem(new Label("3"), VBoxLayout.HAlign.Center, false);
dd.addItem(new Spacer(new Vector3f(348, 0, 0)));
Container c = new Container(new HBoxLayout(0, FillMode.First, false));
c.addChild(new Label("Spacer ->"), false, false);
c.addChild(new Spacer(), false, true);
c.addChild(new Label("<- Spacer"), false, false);
dd.addItem(c, true);
dd.setMargins(0);
myWindow.addChild(dd, false, false);
ProgressBar pb = new ProgressBar();
pb.setMessage("Progress");
pb.setProgressPercent(0.6);
myWindow.addChild(pb, false, true);
c = new Container(new HBoxLayout(15, FillMode.Last, true));
c.addChild(new Label("Slider:"), false, false);
Slider slider = new Slider();
c.addChild(slider, true, true);
myWindow.addChild(c, false, true);
Checkbox checkBox = new Checkbox("Checkbox");
myWindow.addChild(checkBox);
Styles styles = GuiGlobals.getInstance().getStyles();
Attributes attrs = styles.getSelector("textField", "advent");
attrs.set("singleLine", false);
TextField tf = new TextField("Hello Word");
tf.setPreferredLineCount(4);
tf.setPreferredWidth(256);
myWindow.addChild(tf);
Button clickMe = myWindow.addChild(new Button("Button"));
clickMe.addClickCommands(source -> System.out.println("The World is Mine."));
TabbedPanel tp = new TabbedPanel();
tp.addTab("Tab 1", new Label("Tab 1"));
tp.addTab("Tab 2", new Label("Tab 2"));
myWindow.addChild(tp, true, false);