nix
nix

Reputation: 2285

Select fragment of a text in JTextArea

I need to select some fragment of a text in JTextArea. How should i do that?...

Upvotes: 3

Views: 924

Answers (1)

JB Nizet
JB Nizet

Reputation: 692231

Use setCaretPosition(selectionStart) followed by moveCaretPosition(selectionEnd). This is documented in JTextComponent's javadoc

Upvotes: 2

Related Questions