import java.awt.*; import java.awt.event.*; public class SimpleJdbTest extends Frame{ Panel p; Button b[]=new Button[2]; int counter=0; SimpleJdbTest() { setSize(100,200); setup(); } void setup (){ p=new Panel(); b[0]= new Button("press"); p.add(b[0]); add(p); b[0].addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { counter++; } }); } public static void main(String args[]) { SimpleJdbTest sjb=new SimpleJdbTest(); sjb.setVisible(true); } }