帮个忙,帮我解个java题

来源:百度知道 编辑:UC知道 时间:2024/07/06 23:26:18
import java.awt.*;
import javax.swing.*;
public class T extends JFrame {
T( ) {
super("GridLayout");
Container con=this.getContentPane();
con.setLayout(new GridLayout(2,3));
con.add(new JButton("a"));
con.add(new JButton("b"));
con.add(new JButton("c"));
con.add(new JButton("d"));
con.add(new JButton("e"));
con.add(new JButton("f"));
setSize(200, 80);
setVisible(true);
}
public static void main(String args[]) {
new T();
}
}
1.画图表示程序运行后的图形界面。
2.如果程序通过实现某个接口处理按钮的动作事件,则该接口名为何?接口中的方法头声明如何?

第二题
接口名ActionListener
方法签名:public void actionPerformed(ActionEvent event)

interface ActionListener

{

  public void actionPerformed(ActionEvent event); 

}