ToDo
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
public class MidiFrameTest extends JFrame implements ActionListener{
JButton[] btlist;
public static void main(String[] argv){
MidiFrameTest mf=new MidiFrameTest();
mf.setVisible(true);
}
public MidiFrameTest(){
setSize(400,300);
btlist=new JButton[5];
Container con=getContentPane();
con.setLayout(new FlowLayout());
for(int i=0;i<btlist.length;i++){
btlist[i]=new JButton(""+i);
btlist[i].addActionListener(this);
con.add(btlist[i]);
}
}
public void actionPerformed(ActionEvent e) {
for(int i=0;i<btlist.length;i++){
if(e.getSource()==btlist[i]){
System.out.println(""+i);
}
}
}
}