+ /**
+ * Get the current cursor position.
+ *
+ * @return the cursor position
+ */
+ public int getCursor() {
+ return cursor;
+ }
+
+ /**
+ * Set the current cursor position.
+ *
+ * @param cursor the new cursor position
+ */
+ public void setCursor(final int cursor) {
+ if ((cursor < 0)
+ || ((cursor >= getDisplayLength())
+ && (getDisplayLength() > 0))
+ ) {
+ throw new IndexOutOfBoundsException("Max length is " +
+ getDisplayLength() + ", requested position " + cursor);
+ }
+ this.cursor = cursor;
+ // TODO: set word
+ }
+