
import java.awt.*; import javax.swing.JFrame; public class La extends JFrame { public La(){ setSize(300, 300); setLayout(new GridLayout(3,3)); setVisible(true); } public static void main(String[]args){ String str[]={"1","2","3","4","5","6","7","8","9"}; Button bt[]=new Button[str.length]; La la=new La(); for(int i=0;i<str.length;i++){ bt[i]=new Button(str[i]); la.add(bt[i]); } } }
自己参考一下,我没时间给你注释,不懂再问

思考赐予新生,时间在于定义