# Move cursor using python in a text box

**URL:** <https://forum.inductiveautomation.com/t/move-cursor-using-python-in-a-text-box/17663>\
**Category:** General Discussion\
**Created:** [April 10, 2018, 7:37pm UTC](https://forum.inductiveautomation.com/t/move-cursor-using-python-in-a-text-box/17663 "2018-04-10T19:37:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![m.edmonson](https://avatars.discourse-cdn.com/v4/letter/m/8e7dd6/32.png) [@m.edmonson](https://forum.inductiveautomation.com/u/m.edmonson)\
**Post date:** [April 10, 2018, 7:37pm UTC](https://forum.inductiveautomation.com/t/move-cursor-using-python-in-a-text-box/17663/1 "2018-04-10T19:37:27Z")

</div>

Hello,  
Im attempting to make a keypad that will pop up when you click on a numeric label for input. in this keypad i want to include the ability to move the cursor back and forward with arrow buttons just like the numbers you see here. anyone have any ideas for the cursor movement? been looking for some python library but havent found anything.

thanks in advance. ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/a/aa9748dc2bec4fc70e29acb0577ea2788706f5a6.JPG)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 10, 2018, 7:58pm UTC](https://forum.inductiveautomation.com/t/move-cursor-using-python-in-a-text-box/17663/2 "2018-04-10T19:58:59Z")

</div>

Well, the edit field inherits from JTextComponent, so you probably want to just use its [select()](https://docs.oracle.com/javase/8/docs/api/javax/swing/text/JTextComponent.html#select-int-int-) method, followed by setting focus to it again. Give it the same character position for both start and end to yield no selection with the cursor at that point.
