Advertisement
Guest User

Untitled

a guest
Jul 25th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. import java.io.*;
  2. import java.awt.MouseInfo;
  3.  
  4.  
  5. String date;
  6. String time;
  7. PrintWriter output = null;a
  8. int x;
  9. int y;
  10. int val =2;
  11. void draw() {
  12. x = MouseInfo.getPointerInfo().getLocation().x;
  13. y = MouseInfo.getPointerInfo().getLocation().y;
  14.  
  15. if(MouseInfo.getPointerInfo().getLocation().x != 0 || MouseInfo.getPointerInfo().getLocation().y != 0) val =1;
  16.  
  17. if (val ==1){
  18. date = nf(month(),2) + "/" + nf(day(),2) + "/" +year() ;
  19. time = nf(hour(),2) + ":" + nf(minute(),2) + ":" + nf(second(),2);
  20.  
  21. println("found something");
  22. try
  23. {
  24. output = new PrintWriter(new BufferedWriter(new FileWriter("today.txt", true)));
  25. output.println(date + "," + time);
  26. }
  27. catch (IOException e)
  28. {
  29. println("haha you have an error");
  30. }
  31. finally
  32. {
  33. if (output != null)
  34. {
  35. output.close();
  36. }
  37. }
  38.  
  39. delay()
  40.  
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement