Guest User

Untitled

a guest
Jul 20th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. package scripts;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Graphics;
  5.  
  6. import com.kbotpro.scriptsystem.events.PaintEventListener;
  7. import com.kbotpro.scriptsystem.interfaces.Looped;
  8. import com.kbotpro.scriptsystem.runnable.Script;
  9.  
  10. public class TestScript extends Script implements PaintEventListener
  11. {
  12. public boolean canStart()
  13. {
  14. return true;
  15. }
  16.  
  17. public void pause()
  18. {
  19. log.log("We have aids");
  20. }
  21.  
  22. public String getName()
  23. {
  24. return "Test Script";
  25. }
  26.  
  27. public void onStart()
  28. {
  29. log.logIrrelevant("Started");
  30. }
  31.  
  32. public void registerWorkers()
  33. {
  34. createWorker(new Looped()
  35. {
  36. private int counter = 0;
  37. public int loop()
  38. {
  39. ++counter;
  40. if (counter < 15)
  41. {
  42. log.log("Looped around " + counter + " times");
  43. return 1000;
  44. }
  45. else
  46. {
  47. return -1;
  48. }
  49. }
  50. } );
  51. }
  52.  
  53. public void stop()
  54. {
  55. // TODO Auto-generated method stub
  56. }
  57.  
  58. public void onRepaint(Graphics graphics)
  59. {
  60. graphics.setColor(Color.red);
  61. graphics.drawString("This is the paint", 20, 20);
  62. }
  63. }
Add Comment
Please, Sign In to add comment