import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class TextInsert extends Applet implements ActionListener
{
TextArea ta=new TextArea("Welcome to text insert \n application"+
"place the cursor to insert text and enter \n"+
"the text to insert in text box then click \n"+
"insert button",10,20);
TextField t1=new TextField(10);
TextField t2=new TextField(10);
Button b1=new Button("Insert");
public void init()
{
add(ta);
add(new Label("position"));
add(t1);
add(new Label("string"));
add(t2);
add(b1);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
ta.insertText(t2.getText(),Integer.parseInt(t1.getText()));
}
}
output:
0 comments:
Post a Comment