Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
TextArea (または他のテキスト コンポーネント) でテキスト カーソルを移動することは可能ですか? どのように?それを行う機能はありますか?
TextArea と 2 つのボタンがあるとします。最初のボタンを押すたびに、テキスト カーソルが 2 番目の文字と 3 番目の文字の間の位置に移動します。2 文字のみの場合、テキスト カーソルは文字列の末尾に移動します。2 番目のボタンを押すたびに、テキスト カーソルが文字列の先頭に移動します。
誰でも私を助けることができますか?前のThx:D
TextAreaでテキストカーソルを移動することは可能ですか
Java ではa と呼ばcaretれます。メソッド名にキャレットを含むメソッドの API を確認してください。例えば:
caret
textArea.setCaretPosition( textArea.getCaretPosition() + 1 );