[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

TextArea display Only

Posted on 1998-04-21
1
Medium Priority
?
272 Views
Last Modified: 2012-06-27
I have a textarea that I have enabled and editable is false.  But the user can highlight and place the cursor in the textarea.  How do I prevent the user for being able to do that but slight allow them to scroll?
0
Comment
Question by:bcsystem
1 Comment
 
LVL 1

Accepted Solution

by:
dufort earned 20 total points
ID: 1219232
Here's how I would do it : design a Container class that has a CardLayout. On the first card, put your TextArea. On the second card, put a MultiLineLabel in a ScrollPane (the code for the MultiLineLabel component can be found easily on the Internet, just dig a little and you'll find it).

Ok, now suppose you called your special container class ProtectedTextArea.
- ProtectedTextArea.setEditable(true) will bring the first card on top with CardLayout's first() method.
- ProtectedTextArea.setEditable(false) will copy the TextArea's text to the MultiLineLabel and put its ScrollPane on the top with CardLayout's last() method.

That should really be a piece of cake once you got a MultiLineLabel class; I guess you can program your ProtectedTextArea class in less than 30 lines.

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
This video teaches viewers about errors in exception handling.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month19 days, 21 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question