icekontroi

Focus not working properly

Jan 8th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. package scripts.Test;
  2.  
  3. import org.tribot.api.input.Mouse;
  4. import org.tribot.script.Script;
  5. import org.tribot.script.ScriptManifest;
  6.  
  7. import java.awt.*;
  8. import java.awt.event.FocusEvent;
  9. import java.awt.event.FocusListener;
  10.  
  11.  
  12. @ScriptManifest(authors = "IceKontroI",
  13. name = "Focus tester",
  14. category = "@ utils", description = "Tests the focus gain/loss events.")
  15. public class FocusTester extends Script implements FocusListener {
  16.  
  17. @Override
  18. public void run() {
  19.  
  20. this.setLoginBotState(false);
  21.  
  22. Mouse.move(new Point(100, 100));
  23. Mouse.click(1);
  24. Mouse.leaveGame(true);
  25.  
  26. System.out.println("Try clicking the client, and then clicking something in the background.");
  27. System.out.println("You cannot manually fire focusGained() or focusLost() even though it should.");
  28.  
  29. while (true) {
  30. sleep(100);
  31. }
  32. }
  33.  
  34. @Override
  35. public void focusGained(FocusEvent e) {
  36. System.out.println("Focus was gained");
  37. }
  38.  
  39. @Override
  40. public void focusLost(FocusEvent e) {
  41. System.out.println("Focus was lost");
  42. }
  43. }
Add Comment
Please, Sign In to add comment