Saturday, August 17, 2013

PROGRAM TO CREATE BUTTON


PROGRAM:
~~~~~~~~~
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class A extends JApplet implements ActionListener
{
public void init()
{
   
    JButton jb=new JButton("SUBMIT");
    setLayout(new FlowLayout());
   
    add(jb);
    setVisible(true);
}

    public void actionPerformed(ActionEvent e)
    {
   
    }  
 }
NOTE:
~~~~~

add(jlb)--> To add the component Button 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
ActionListener-->Interface in the java.awt.event.*; package
   public void actionPerformed(ActionEvent e)-->Abstract method in ActionListener Interface


OUTPUT:
~~~~~~~


No comments:

Post a Comment

Animated Social Gadget - Blogger And Wordpress Tips