详细注释下,每个按钮点击做的动作。

解决方案 »

  1.   

    这个可以理解,都是这样过来的,加油啊!!!你可以看一下这个代码??
    import javax.swing.*;
    import java.awt.*;
    public class MyFrame extends JFrame
    {
    public MyFrame() //构造方法
    {
    JPanel p1 = new JPanel(); //定义面板
    p1.setLayout(new GridLayout(4,3));//定义网格形式
    for(int i=0;i<=9;i++)        //添加按钮
    p1.add(new JButton(""+i));
    p1.add(new JButton(""+0));
    p1.add(new JButton("start"));
    p1.add(new JButton("end"));
    add(p1);  //添加面板
    }
    public static void main(String [] args)
    {

    MyFrame frame = new MyFrame(); 
    frame.setSize(400,300);
    frame.setTitle("MyFrame");
    frame.setLocationRelativeTo(null);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
    }
    }
      

  2.   

    初学的看视频,别看代码敲,别人给你的思维是定性的。
    GUI 不是很重要的部分。