Core Java - [Applet: AWT TextField/TextArea]

♠ Posted by Unknown in at 06:14

Applet: AWT TextField/TextArea

//Write a Java Applet that create some text fields and text areas to demonstrate features of each.

package mj;

import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class TextFieldExample extends Applet implements ActionListener
{
Image: Java TextField/TextArea    TextArea txaName;
    TextField txfCity;
    
    public void init()
    {
        txaName = new TextArea(10, 20);
        add(txaName);

        txfCity = new TextField(20);
        add(txfCity);

        txfCity.addActionListener(this);
   }
   
  public void actionPerformed(ActionEvent e)
  {
        txaName.append(" "+e.getActionCommand());
        txfCity.setText(" ");
  }
  
}

1 comments:


Thanks for sharing this good blog.This is very important and imformative blog for Java .It's very interesting and useful for students
Java Online Training Hyderabad

Post a Comment