创建自定义事件组
1 /** 2 * @author Beck 3 *创建自定义事件组 4 */ 5 public class EnrollmentEvent extends java.util.EventObject{//扩展java.util.EventObject类 6 private String studentToEnroll; 7 private int enrollmentCap; 8 9 public EnrollmentEvent(Object source, String studentToEnroll, int enrollmentCap){ 10 /*必须调用EventObject的构造方法,并把源对象作为参数传递给该方法*/ 11 super(source); 12 this.studentToEnroll = studentToEnroll; 13 this.enrollmentCap = enrollmentCap; 14 } 15 16 public String getStudentToEnroll(){ 17 return studentToEnroll; 18 } 19 20 public long getEnrollmentCap(){ 21 return enrollmentCap; 22 } 23 }