Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Textareas

Posted on 1998-09-03
4
Medium Priority
?
268 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
[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
4 Comments
 

Author Comment

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

Accepted Solution

by:
bernfarr earned 200 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

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses

610 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