I need to make an applet to view sourcecode and not be able to
highlight or select any of the text to copy it.. is there a way to make
a textarea do this.. or am I gonna have to make my own widget to handle
this?
I haven't tried this recently but I _think_ if you set the area disabled you
won't be able to highlight it or select any of it:
JTextArea myTextArea = new JTextArea("bla bla bla");
myTextArea.setEnabled(false);
Of course, this will grey out the text too, which you might not like too
much since it makes the text harder to read.
If you simply want to prevent anyone from dragging and dropping all or part
of the text, I think
myTextArea.setDragEnabled(false);
should do the job. The user will probably still be able to highlight parts
of the text area - again, I haven't tried this in a while so I could be
wrong - but they won't be able to drag it anywhere so they can't do much
harm.