Solved

TextArea display Only

Posted on 1998-04-21
1
266 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 10 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Python Assistance 7 80
Where to store the queries for modification of table 4 61
maven project error 5 54
Desingning Refactoring existing code 2 24
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

776 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