Button.java 777 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package control.button;
  2. import java.awt.Color;
  3. import main.Window;
  4. import control.NetworkHandler;
  5. public class Button {
  6. Color color;
  7. int ledID;
  8. int buttonID;
  9. NetworkHandler ntw;
  10. public int pressed;
  11. public Button(int buttonID, int ledID, NetworkHandler ntw)
  12. {
  13. color = new Color(255,255,255);
  14. this.ledID = ledID;
  15. this.buttonID = buttonID;
  16. this.ntw = ntw;
  17. pressed = 1;
  18. setLed();
  19. }
  20. private void setLed()
  21. {
  22. if(Window.ON_ARCADE)
  23. {
  24. ntw.setLed(ledID, color.getGreen(), color.getRed(), color.getBlue());
  25. ntw.show();
  26. }
  27. }
  28. public void setColor(Color newColor)
  29. {
  30. color = newColor;
  31. setLed();
  32. }
  33. public Color getColor(){
  34. return color;
  35. }
  36. public int getButtonID()
  37. {
  38. return buttonID;
  39. }
  40. public int getLedID()
  41. {
  42. return ledID;
  43. }
  44. }