Solved

Textareas

Posted on 1998-09-03
4
231 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

744 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

10 Experts available now in Live!

Get 1:1 Help Now