Skip to main content

Example of TextField & TextArea AWT

TextField & TextArea:

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*<applet code="TextFieldDemo" width=300 height=300></applet>*/
public class TextFieldDemo extends Applet implements ActionListener, TextListener
{
TextArea ta;
TextField tf;
public void init()
{
tf=new TextField(20);
tf.addActionListener(this);
tf.addTextListener(this);
add(tf);
ta=new TextArea(10,20);
add(ta);
}
public void actionPerformed(ActionEvent ae)
{
ta.append("ActionEvent: "+ae.getActionCommand()+"\n");
tf.setText("");
}
public void textValueChanged(TextEvent te)
{
ta.append("TextEvent: "+tf.getText()+"\n");
}
}

Comments

  1. I guess I am the only one who came here to share my very own experience. Guess what!? I am using my laptop for almost the past 2 years, but I had no idea of solving some basic issues. I do not know how to Crack Softwares Free Download But thankfully, I recently visited a website named ProCrackHere
    Transor for Whatsapp Crack
    Wavepad Sound Editor Crack

    ReplyDelete

Post a Comment

Popular posts from this blog

What is Servet ?

A servlet is a java class that extends an application hosted on a web server. Handles the HTTP request-response process (for our purposes) Often thought of as an applet that runs on a server. Provides a component base architecture for web development, using the Java Platform The foundation for Java Server Pages (JSP). Alternative to CGI scripting and platform specific server side applications.

Latest Java 6 to 10

6. What are the access modifiers in java ? There are 3 access modifiers. Public, protected and private, and the default one if no identifier is specified is called friendly, but programmer cannot specify the friendly identifier explicitly. 7. What is are packages? A package is a collection of related classes and interfaces providing access protection and namespace management. 8. What is meant by Inheritance and what are its advantages? Inheritance is the process of inheriting all the features from a class. The advantages of inheritance are reusability of code and accessibility of variables and methods of the super class by subclasses. 9. What is the difference between superclass and subclass? A super class is a class that is inherited whereas sub class is a class that does the inheriting. 10. What is an abstract class? An abstract class is a class designed with implementation gaps for subclasses to fill in and is deliberately incomplete.

51 to 55 Java Questions

51. What is the difference between a constructor and a method? A constructor is a member function of a class that is used to create objects of that class. It has the same name as the class itself, has no return type, and is invoked using the new operator. A method is an ordinary member function of a class. It has its own name, a return type (which may be void), and is invoked using the dot operator. 52. What will happen to the Exception object after exception handling? Exception object will be garbage collected. 53. Difference between static and dynamic class loading. Static class loading: The process of loading a class using new operator is called static class loading. Dynamic class loading: The process of loading a class at runtime is called dynamic class loading. Dynamic class loading can be done by using Class.forName(….).newInstance(). 54. Explain the Common use of EJB The EJBs can be used to incorporate business logic in a web-centric application. The EJBs can b...