Java applet program to display textfields

      No Comments on Java applet program to display textfields

Display textfields

This program illustrate the concept how to display textfields in applet.

  • Every input in the textfield will be treated as a string.
  • Textfield means area of screen in which user can type or edit the input.
  • We can made a textfield using a Texfield class of applet package.

Let us understand with program.

  • init() is called the initialisation state.Applet enters the initialisation when it is first loaded.
  • Here t1=new TextField(10); will create a texfield which can hold maximum 10 string.
  • add(ti) will display the TextField.

scanfcode.java

import java.awt.*;
import java.applet.*;
public class scanfcode extends Applet
{
	TextField t1,t2;
	public void init()
	{
		t1=new TextField(10);
		add(t1);
		 
		t2=new TextField(10);
		add(t2);
		
	}
 
}

Scanfcode.html

<html>
<head>
<title>
<p>First applet program</p>
</title>
</head>
<body>
<applet code="scanfcode.class" width="350" height="350">
</applet>
</body>
</html>

Command to run display viewer

Display textfields

OUTPUT

Display textfields


Comment below if you are facing any problem.


Java first applet program to display WELCOME TO SCANFCODE
Java applet program to display numerical values


Summary
Java applet program to display textfields
Article Name
Java applet program to display textfields
Description
This program illustrate the concept how to display textfields in applet.Every input in the textfield will be treated as a string.
Author
Publisher Name
Scanfcode
Publisher Logo

Leave a Reply

Your email address will not be published. Required fields are marked *