!7

p-subst {
  showText(lines(repF(10, f aGlobalID)));
    
  repeat with ms sleep 500 {
    awt {
      Component c = componentAtMouse();
      if (c != null) {
        Point d = mouseToComponent(c);
        print("Mouse: " + d.x + ", " + d.y + ": " + c);
        if (c instanceof JTextComponent) {
          JTextComponent tc = cast c;
          int idx = tc.viewToModel(d);
          S text = tc.getText();
          S word = wordAtMouse();
          print("  " + quote(word) + " / " + quote(substring(text, idx-1, idx+1)));
        }
      } else
        print("Mouse: " + c);
    }
  }
}