Help Me with this program please?
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:
public class ButtonClicks extends Frame
setTitle("Click the button");
public static void main(String args)
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);
Re: Help Me with this program please?
Is there a reason why you aren't using Swing? (JFrame, JButton, etc)
Basically you should write an action handler that sets the button text. And add that handler to the button so that it does its thing in response to button clicks.