主程序类: package JavaDome; import java.awt.Container; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; public class JingZiQiMain { public static void main(String[] args) { JFrame w = new JFrame("井字棋"); w.setBounds(600, 200, 300, 200); Container contentPane = w.getContentPane(); // 容器 JButton bt = new JButton("开始游戏"); bt.setFont(new Font("楷体", Font.BOLD, 50)); bt.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Test t = new Test();//调用 w.setVisible(false); } }); contentPane.add(bt); w.setVisible(true); } } 测试类: package JavaDome; import java.awt.Color; import java.awt.Container; import java.awt.Font; import java