01: package org.uispec4j.extension;
02:
03: import javax.swing.*;
04: import java.awt.event.ActionEvent;
05: import java.awt.event.ActionListener;
06:
07: public class JCountingButton extends JButton {
08: private int count;
09:
10: public JCountingButton(String text) {
11: super (text);
12: addActionListener(new ActionListener() {
13: public void actionPerformed(ActionEvent e) {
14: count++;
15: }
16: });
17: }
18:
19: public void reset() {
20: count = 0;
21: }
22:
23: public int getCount() {
24: return count;
25: }
26: }
|