So I have this program here, and it's a simple java AWT program that creates a button. as of right now, it works just fine, but I want to make it so that it counts the number of times the button is clicked, and then displays that number on the button itself, but I don't know how to do that
here's my program:
import java.awt.*;
import java.awt.event.*;
public class ButtonClicks extends Frame
{
ButtonClicks()
{
setTitle("Click the button");
setSize(200, 200);
}
public static void main(String args[])
{
Frame x;
Button b;
Label l;
x = new ButtonClicks();
b = new Button("Button");
l = new Label("Click the button");
l.setBounds(30, 50, 100, 30);
b.setBounds(80, 50, 50, 30);
x.add(b);
x.add(l);
}
}