Mouse position: Difference between revisions
Content added Content deleted
(Added Kotlin) |
(→{{header|Kotlin}}: Updated example see https://github.com/dkandalov/rosettacode-kotlin for details) |
||
Line 517: | Line 517: | ||
=={{header|Kotlin}}== |
=={{header|Kotlin}}== |
||
{{trans|Groovy}} |
{{trans|Groovy}} |
||
<lang scala>// version 1.1. |
<lang scala>// version 1.1.2 |
||
import java.awt.MouseInfo |
import java.awt.MouseInfo |
||
Line 525: | Line 525: | ||
Thread.sleep(1000) |
Thread.sleep(1000) |
||
val p = MouseInfo.getPointerInfo().location // gets screen coordinates |
val p = MouseInfo.getPointerInfo().location // gets screen coordinates |
||
println("${it}: x = ${"%-4d".format(p.x)} y = ${"%-4d".format(p.y)}") |
println("${it}: x = ${"%-4d".format(p.x)} y = ${"%-4d".format(p.y)}") |
||
} |
} |
||
}</lang> |
}</lang> |