sclass JImageSwitch > JLabel { IVarWithNotify var; bool on; *(S offImageID, S *onImageID, IVarWithNotify var) { bindListenerToComponent(var, this, r { set(var!) }); on = var!; updateIcon(); } void updateIcon { setIcon(imageIcon(loadImage2(on ? onImageID : offImageID))); } void set(bool value) swing { if (on != value) { on = value; updateIcon(); } } }