Solved

Textareas

Posted on 1998-09-03
4
245 Views
Last Modified: 2010-03-30
 How do i prevent users from changing the contents of the
  textarea displayed on the applet? How do i make it a read
  only display?
0
Comment
Question by:kans
4 Comments
 

Author Comment

by:kans
ID: 1223506
Edited text of question
0
 
LVL 2

Accepted Solution

by:
bernfarr earned 50 total points
ID: 1223507
From the Java Class Library book. Excuse any typos. The call you want is the setEditable() one below.

import java.awt.*;
class Main extends Frame {
TextArea ta = new TextArea();
Checkbox cb = new Checkbox("Editable", null, true );

Main() {
super( "setEditable example" );
add( "Center", ta );
add( "South", cb );
pack();
show();
}

public boolean action(Event evt, Object ob ){
  if ( evt.target == cb ) {
    ta.setEditable( cb.getState() );
  }
  return true;
}

static public void main(String[] args) {
  new Main();
}
}

0
 
LVL 3

Expert Comment

by:sailwind
ID: 1223508
Simply invoke the textArea's setEditable method to be false.

TextField mytext = new TextField();
mytext.setEditable(false);

0
 

Expert Comment

by:pureDan
ID: 1223509
If U want to prevent someone to change your TextArea context
use SetEditable(false) method, this way.
-----
//your previously defined TextArea
TextArea ta=new TextArea();
ta.setEditable(false);
------
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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…
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 …
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…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

839 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