Thursday, October 13, 2016

a program for javabean to add a button to the bean and display the number of times the button has been clicked

Aim: write a program for javabean to add a button to the bean and display the number of times the button has been clicked.

Program:

package sunw.demo.incr;
import java.io.*;
import java.awt.*;
public class Cnt extends Canvas
{
public int count;
public Cnt()
{
count=0;
}
public void paint(Graphics g)
{
int c=count++;
String msg="COUNT = "+c;
g.drawString(msg,10,10);
}
}

Output:






Labels:

1 Comments:

At September 20, 2019 at 7:31 PM , Blogger Yashwanth bandi said...

This comment has been removed by the author.

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home