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