初学者的实例 import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Snake extends JFrame { private JPanel contentPane; //窗体内容网格 private JButton btnStart = new JButton("开始"); //游戏开始按钮 private JButton btnPause = new JButton("暂停"); //游戏暂停按钮 private JButton btnExit = new JButto