Friday, 27 May 2011

java applet button example


/* <applet code="button" width=200 height=100> </applet> */
import java.awt.*;
import java.applet.*;
import java.awt.event.*;

public class button extends Applet {

MyButton myButton;
static int i = 0;
public void init() {
myButton = new MyButton("Test Button");
add(myButton);
}
class MyButton extends Button {
  public MyButton(String label) {
  super(label);
  enableEvents(AWTEvent.ACTION_EVENT_MASK);
  }
  protected void processActionEvent(ActionEvent ae) {
  showStatus("action event : " + i++);
  super.processActionEvent(ae);
  }
  }
  }
 
Post a Comment