Saturday, August 17, 2013

PROGRAM FOR DISPLAY TEXTBOX AND LABEL

PROGRAM:
~~~~~~~~~
import javax.swing.*;
import java.awt.*;

public class A extends JApplet
{
public void init()
{
    JLabel jl=new JLabel("NAME");//to create Label
    JTextField jt=new JTextField(10);//to create textbox.Allows only 10 characters
    setLayout(new FlowLayout());
    add(jl);
    add(jt);
    setVisible(true);
}

       }

NOTE:
~~~~~
add(jl)--> To add the component Label to the container.
init( )--> Life cycle function of the Applet
setLayout--> Type in Layout Manager.Responsible to display components in manner
JApplet-->Predefined class in Java
setVisible(true)-->to make the components of the container visible in screen

 OUTPUT:
~~~~~~~

No comments:

Post a Comment

Animated Social Gadget - Blogger And Wordpress Tips