!7 p-subst { repeat with ms sleep 500 { awt { Component c = componentAtMouse(); if (c != null) { Point m = mouseLocation(); //Point p = c.locationOnScreen(); //Point d = new Point(m.x-p.x, m.y-p.y); Point d = m; SwingUtilities.convertPointFromScreen(d, 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 = wordAroundIndex(text, idx); print(" " + idx + "/" + l(text) + ": " + quote(word)); } } else print("Mouse: " + c); } } }