I have a JFrame that displays the current movies that are stored on my computer. It displays the names of the files as String
s in a JTextArea
.
What I want to do is to double-click a particular String
(which represents an actual file on my computer) and that file would be opened.
The opening part and double-click part is already solved, but when I double-click on the String
in my JTextArea
only a part of that String
will be selected. (I'm using JTextArea.getSelectedText()
).
What I want is that the whole String
is selected and that I can retrieve the String
. I need to do this since some of my movie files have similar names and the wrong file would be opened.
Is there any already implemented method that can extend the selection to a whole line? I've tried to Google the problem but nothing will select the whole line of text.
An example: http://i47.tinypic.com/wvol6a.png
Thank you all for the input and I'm sorry that i was unclear regarding the JTextArea, the JTextArea was mandatory.
I have now a solution to my problem and I thank Hovercraft Full Of Eels for this.