/** convenience key setting adder */ public SettingKey addSetting(Widget w2, String nicename, String backendname, int value) { SettingKey s = new SettingKey(backendname, value); WidgetKeybinding w = new WidgetKeybinding(s, nicename); w2.add(w); append(s); return s; }
/** convenience text setting adder */ public SettingText addSetting(Widget w2, String nicename, String backendname, String value) { SettingText s = new SettingText(backendname, value); WidgetText w = new WidgetText(s, nicename); w2.add(w); append(s); return s; }
/** convenience float setting adder */ public SettingFloat addSetting(Widget w2, String nicename, String backendname, float value) { SettingFloat s = new SettingFloat(backendname, value); WidgetFloat w = new WidgetFloat(s, nicename); w2.add(w); append(s); return s; }
/** convenience boolean setting adder */ public SettingBoolean addSetting(Widget w2, String nicename, String backendname, boolean value) { SettingBoolean s = new SettingBoolean(backendname, value); WidgetBoolean w = new WidgetBoolean(s, nicename); w2.add(w); append(s); return s; }
/** convenience multi setting adder */ public SettingMulti addSetting( Widget w2, String nicename, String backendname, int value, String... labels) { SettingMulti s = new SettingMulti(backendname, value, labels); WidgetMulti w = new WidgetMulti(s, nicename); w2.add(w); append(s); return s; }
/** convenience int setting adder */ public SettingInt addSetting( Widget w2, String nicename, String backendname, int value, int min, int step, int max) { SettingInt s = new SettingInt(backendname, value, min, step, max); WidgetInt w = new WidgetInt(s, nicename); w2.add(w); append(s); return s; }
private void addTestAlert(int x, int y, String text) { Alert alert = new Alert(text); alert.addButton("OK"); alert.addButton("Cancel"); alert.setPosition(x, y); root.add(alert); alert.adjustSize(); }
/** convenience list setting adder */ public SettingList addSetting(Widget w2, String nicename, String backendname, String... options) { ArrayList<String> arrayList = new ArrayList<String>(); for (int i = 0; i < options.length; i++) { arrayList.add(options[i]); } SettingList s = new SettingList(backendname, arrayList); WidgetList w = new WidgetList(s, nicename); w2.add(w); append(s); return s; }
public void layout(Widget widget, boolean visible) { if (label != null) { if (label.getParent() != widget) { System.out.println("Adding widget Label"); widget.add(label); } if (visible) { // adjust this to account for view location Vector2D labelLocation = Vector2D.subtract( getLocation(), -Main.viewLocation.x, (Main.viewLocation.y - Main.SCREEN_HEIGHT)); // Vector2D labelLocation = Vector2D.subtract( Main.viewLocation, // getLocation()); label.setPosition((int) labelLocation.x, (int) labelLocation.y); label.setText(name); label.adjustSize(); } label.setVisible(visible); } }