I’m making a custom component, but the “<” and “>” symbols should be centered (click on the image to view them). What am I missing?
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
import static com.pesegato.p8s.appstates.MainMenuAppState2.SMALL_AMETHYST;
import com.simsilica.lemur.ActionButton;
import com.simsilica.lemur.Axis;
import com.simsilica.lemur.CallMethodAction;
import com.simsilica.lemur.Container;
import com.simsilica.lemur.Label;
import com.simsilica.lemur.component.DynamicInsetsComponent;
import com.simsilica.lemur.component.SpringGridLayout;
import com.simsilica.lemur.style.ElementId;
public class ASlider extends Node {
ActionButton decrease;
ActionButton increase;
Label center;
PurpleWrapper pe;
String label;
public ASlider(String label, PurpleWrapper pe) {
this.pe = pe;
this.label = label;
Container row = new Container(new SpringGridLayout(Axis.X, Axis.Y));
row.setPreferredSize(new Vector3f(500, SMALL_AMETHYST, 0));
decrease = new ActionButton(new CallMethodAction("<", this, "decrease"), new ElementId("circle.button"));
decrease.setPreferredSize(new Vector3f(SMALL_AMETHYST, SMALL_AMETHYST, 0));
decrease.setLocalTranslation(0, 0, 0);
row.addChild(decrease);
center = new Label(label + pe.getValue(), new ElementId("mini.label"));
center.setPreferredSize(new Vector3f(350, SMALL_AMETHYST, 0));
center.setInsetsComponent(new DynamicInsetsComponent(0.5f, 0, 0.5f, 0));
center.setLocalTranslation(100, 0, 0);
row.addChild(center);
increase = new ActionButton(new CallMethodAction(">", this, "increase"), new ElementId("circle.button"));
increase.setPreferredSize(new Vector3f(SMALL_AMETHYST, SMALL_AMETHYST, 0));
increase.setLocalTranslation(500, 0, 0);
row.addChild(increase);
attachChild(row);
}
public ActionButton getDecreaseButton() {
return decrease;
}
public ActionButton getIncreaseButton() {
return increase;
}
public void decrease() {
pe.decrease();
center.setText(label + pe.getValue());
}
public void increase() {
pe.increase();
center.setText(label + pe.getValue());
}
}
The style is on pastebin