Solved

TextArea display Only

Posted on 1998-04-21
1
268 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Why my table column Id is not passed to java object? 4 46
How to determine if a string is a valid SHA value 7 43
Bot application - advice 3 61
learn programming 8 69
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
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 …

749 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