protected Group createIface () {
final Field prefix = new Field("Love Potion Number ");
Button add10 = new Button("+10");
Button add100 = new Button("+100");
HistoryGroup.Labels history = new HistoryGroup.Labels();
final SizableGroup historyBox = new SizableGroup(new BorderLayout());
historyBox.add(history.setConstraint(BorderLayout.CENTER));
Slider width = new Slider(150, 25, 1024);
Group top = new Group(AxisLayout.horizontal()).add(
prefix.setConstraint(AxisLayout.stretched()), add10, add100, width);
width.value.connectNotify(new Slot<Float>() {
@Override public void onEmit (Float val) {
historyBox.preferredSize.updateWidth(val);
}
});
add10.clicked().connect(addSome(history, prefix, 10));
add100.clicked().connect(addSome(history, prefix, 100));
history.setStylesheet(Stylesheet.builder().add(Label.class,
Style.BACKGROUND.is(Background.composite(
Background.blank().inset(0, 2),
Background.bordered(Colors.WHITE, Colors.BLACK, 1).inset(10))),
Style.TEXT_WRAP.on, Style.HALIGN.left).create());
history.addStyles(Style.BACKGROUND.is(Background.beveled(
Colors.CYAN, Colors.brighter(Colors.CYAN), Colors.darker(Colors.CYAN)).inset(5)));
_lastNum = 0;
return new Group(AxisLayout.vertical()).add(
top, historyBox.setConstraint(AxisLayout.stretched())).addStyles(
Style.BACKGROUND.is(Background.blank().inset(5)));
}