import java.awt.*;
import java.awt.event.*;
public class BtnTest extends Frame implements ActionListener
{
	Button b1,b2;
	
	public BtnTest () {
		super();
		setSize(300,100);
		Panel p1 = new Panel();
		b1 = new Button("BTN1");
		b1.addActionListener(this);
		p1.add(b1);
		b2 = new Button("BTN2");
		b2.addActionListener(this);
		p1.add(b2);
		add(p1,BorderLayout.CENTER);
	}
	
	public static void main(String args[]) {
		BtnTest f = new BtnTest();
		f.show();
	}
	
//ここでボタンを調べる
	public void actionPerformed(ActionEvent e) {
		if (e.getSource() == b1) {
			//Btn1();
		} else {
			//Btn2();
		}
	}
}
                                    どのボタンが押されたか?
トラックバック(0)
トラックバックURL: http://winnote.adg7.com/mt/mt-tb.cgi/246
 
 
コメントする