package ch.spherICIT.components.led; import ch.spherICIT.main.Message; import javax.swing.ImageIcon; import javax.swing.JLabel; public class Led extends JLabel { private ImageIcon onIcon; private ImageIcon offIcon; public Led() { super(); this.onIcon = new ImageIcon(getClass().getResource("/blue_led_on.png")); this.offIcon = new ImageIcon(getClass().getResource("/blue_led_off.png")); } public void switchOn() { setIcon(this.onIcon); repaint(); } public void switchOff() { setIcon(this.offIcon); repaint(); } public void doSwitch(String state) { if(state.toLowerCase().equals(Message.CMD_VAL_ON.toLowerCase())) { switchOn(); } else { switchOff(); } } }