Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JTextArea / Disabling selection

843804Sep 16 2001 — edited Dec 21 2004
Im getting a bit frustrated with this, hence my post....
I have a JTextArea, in which will contain various text.
The component should not be editable, and likewise should not be selectable.....

I still have not found a way to disable text selection in a JTextArea, in fact any subclass of JTextComponent for that matter.

why setEnabled(false) does not prevent selection is beyond me........

I had a similar problem once before, and my solution was to set selection color to thed, which worked just fine, despite not really solving the problem....

I would probably go ahead and use this technique again, however I have a different situation here, Im using a translucent background, (0,0,0,0) and setting selection color to this value does not seem to work...

Is there a way to totaly disable selection???

Should I possibly use a different component to handle the task, which does not support selection, ( Ihavent found anything yet). I need to have line wrap so a few of the more basic components are out of question....

Im hoping some would give me some suggestions on this, they will be greatly apreciated, and as always adequately rewared....
Thanks
J.Prisco
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 18 2005
Added on Sep 16 2001
19 comments
1,688 views