public ScreenSwitch(ScreenCanvas canvas, UISwitch uiSwitch) { this(canvas); this.uiSwitch = uiSwitch; if (uiSwitch.getOnImage() != null) { setIcon(uiSwitch.getOnImage().getSrc()); } }
public void onStateChange() { if (uiSwitch.canUseImage()) { if (isOn) { isOn = false; image.setUrl(uiSwitch.getOffImage().getSrc()); } else { isOn = true; image.setUrl(uiSwitch.getOnImage().getSrc()); } } }