use of jcog.math.EnumParam in project narchy by automenta.
the class AutoSurface method newSwitch.
private ButtonSet newSwitch(EnumParam x) {
ToggleButton[] b = ((EnumSet<?>) EnumSet.allOf(x.klass)).stream().map(e -> {
CheckBox tb = new CheckBox(e.name());
tb.on((c, enabled) -> {
if (enabled)
x.set(e);
});
return tb;
}).toArray(ToggleButton[]::new);
ButtonSet s = new ButtonSet(ButtonSet.Mode.One, b);
return s;
}
Aggregations