Previous | Home | Next |
In this example we are going to show how to use Text area. It is also called multi line editor Text Area defined the following constructor.
TextArea(): It create a default text field.
TextField(String str): It create a text field with string name.
TextField(int numlines,int numChar): NumLines specified the height , in line of text area.NumChar specified the width in Characters.
TextField(String str, int numlines, int numChar ): String str specified the initial string.
Text area add the following methods
void append(String str): append() method appends the string to the end of the current Text.
void insert(String str ,int index):
voidreplaceRange(String str, int startIndex, int endIndex):
The following program create the text area control.
Example
//Using Text Area import java.awt.*; import java.applet.*; /* <applet code="TextAreaDemo" width=300 height=200> </applet> */ public class TextAreaDemo extends Applet{ public void init() { String val= "my self Shrish Singh \n"+ "I an from unnao\n"+ "I have done my schooling from R.S.S.inter college unnao\n\n"+ "My hobies are playing Cricket Watching Cricket and Football \n"+ "I complite my Technical degree from ABES Engg.college in 2008 \n"+ "This time I am working in a software company name is R4R."; TextArea text = new TextArea(val,5,30); add(text); } }
Output of Example:
Download source code
Previous | Home | Next |