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.

Windows & Frames In AWT

Windows & Frames import java.awt.*; import java.awt.event.*; class Frame1 extends Frame { Frame1(String title) { super(title); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { System.exit(0); } }); } } public class FrameDemo { public static void main(String a[]) { Frame1 f1=new Frame1("This is title"); f1.show(); f1.setSize(200,300); } }

16 to 20 Java questions

16. How do you set security in applets? using setSecurityManager() method 17. What is a layout manager and what are different types of layout managers available in java AWT? A layout manager is an object that is used to organize components in a container. The different layouts are available are FlowLayout, BorderLayout, CardLayout, GridLayout and GridBagLayout 18. What is JDBC? JDBC is a set of Java API for executing SQL statements. This API consists of a set of classes and interfaces to enable programs to write pure Java Database applications. 19. What are drivers available? a) JDBC-ODBC Bridge driver b) Native API Partly-Java driver c) JDBC-Net Pure Java driver d) Native-Protocol Pure Java driver 20. What is stored procedure? Stored procedure is a group of SQL statements that forms a logical unit and performs a particular task. Stored Procedures are used to encapsulate a set of operations or queries to execute on database. Stored procedures can be compiled and...