Solved

TextArea display Only

Posted on 1998-04-21
1
264 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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
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…
This video teaches viewers about errors in exception handling.
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 …

772 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now