Remote Control zum Einschalten des 3D-Druckers und Bewegen der ebCam im Hobbyraum Brand
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Led.java 807B

123456789101112131415161718192021222324252627282930313233343536
  1. package ch.spherICIT.components.led;
  2. import ch.spherICIT.main.Message;
  3. import javax.swing.ImageIcon;
  4. import javax.swing.JLabel;
  5. public class Led extends JLabel {
  6. private ImageIcon onIcon;
  7. private ImageIcon offIcon;
  8. public Led() {
  9. super();
  10. this.onIcon = new ImageIcon(getClass().getResource("/blue_led_on.png"));
  11. this.offIcon = new ImageIcon(getClass().getResource("/blue_led_off.png"));
  12. }
  13. public void switchOn() {
  14. setIcon(this.onIcon);
  15. repaint();
  16. }
  17. public void switchOff() {
  18. setIcon(this.offIcon);
  19. repaint();
  20. }
  21. public void doSwitch(String state) {
  22. if(state.toLowerCase().equals(Message.CMD_VAL_ON.toLowerCase())) {
  23. switchOn();
  24. } else {
  25. switchOff();
  26. }
  27. }
  28. }