Remove TODO file
[remote/remote-gui.git] / src / main / gui / MoteLedsPanel.java
blobaa1459fb7dfae8f6bbff49ce3826b1f4cca40776
1 package gui;
3 import diku.distlab.motecontrolclientlib.client.LedsInputStream;
4 import javax.swing.ImageIcon;
5 import javax.swing.JLabel;
6 import javax.swing.JPanel;
8 public class MoteLedsPanel extends JPanel {
10 private static final long serialVersionUID = 221423246112076656L;
11 private JLabel led0,led1,led2,led3;
12 private ImageIcon gray,red,yellow,green,blue;
14 MoteLedsPanel()
16 java.net.URL grayURL = ReMote.class.getResource("/icons/led-gray.gif");
17 gray = new ImageIcon(grayURL);
19 java.net.URL redURL = ReMote.class.getResource("/icons/led-red.gif");
20 red = new ImageIcon(redURL);
22 java.net.URL greenURL = ReMote.class.getResource("/icons/led-green.gif");
23 green = new ImageIcon(greenURL);
25 java.net.URL yellowURL = ReMote.class.getResource("/icons/led-yellow.gif");
26 yellow = new ImageIcon(yellowURL);
28 java.net.URL blueURL = ReMote.class.getResource("/icons/led-blue.gif");
29 blue = new ImageIcon(blueURL);
31 led0 = new JLabel(gray);
32 led1 = new JLabel(gray);
33 led2 = new JLabel(gray);
34 led3 = new JLabel(gray);
36 add(led0);
37 add(led1);
38 add(led2);
39 add(led3);
42 public void clearLeds()
44 led0.setIcon(gray);
45 led1.setIcon(gray);
46 led2.setIcon(gray);
47 led3.setIcon(gray);
50 public void setLeds(LedsInputStream leds)
52 if (leds.red())
54 led0.setIcon(red);
56 else
58 led0.setIcon(gray);
60 if (leds.green())
62 led1.setIcon(green);
64 else
66 led1.setIcon(gray);
68 if (leds.yellow())
70 led2.setIcon(yellow);
72 else
74 led2.setIcon(gray);
76 if (leds.blue())
78 led3.setIcon(blue);
80 else
82 led3.setIcon(gray);