
/*
* JAVA 小游戏-拼图 我做的第一个小游戏
* Cell 类是继承的按钮类,并加上相应图形,形成方格
*MyCanvas 是一个面板,加载 Cell 类的对象(方格),是这三个类中的核心
*/
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Choice;
import java.awt.Color;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.Icon;
import javax.swing.JButton;
public class MyMainFrame extends JFrame implements ActionListener {
MyCanvas myCanvas;
JPanel panelNorth,panelPreview;//定义上方的面板,及预览所需的面板
Button start,preview,set;//定义开始,预览,设定按钮
Container container;//容器,得到内容面板
public MyMainFrame() {//初使化
container=this.getContentPane();
start=new Button("开始");
start.addActionListener(this);
preview=new Button("预览");
preview.addActionListener(this);
set = new Button("设置");
set.addActionListener(this);