package 小游戏;
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;
public class MyMainFrame extends JFrame
implements ActionListener
{
MyCanvas myCanvas;
JPanel panelSouth;
JPanel panelPreview;
Button start;
Button preview;
Button set;
Container container;
public MyMainFrame()
{
this.container = getContentPane();
this.start = new Button("开始");
this.start.addActionListener(this);
this.preview = new Button("预览");
this.preview.addActionListener(this);
this.set = new Button("选择图片");
this.set.addActionListener(this);
this.panelPreview = new JPanel();
this.panelPreview.setLayout(null);
Icon icon = new ImageIcon("pictrue/pic_" + MyCanvas.pictureID + ".jpg");
JLabel label = new JLabel(icon);
label.setBounds(0, 0, 300, 300);
this.panelPreview.add(label);
this.panelSouth = new JPanel();
this.panelSouth.setBackground(Color.blue);
this.panelSouth.add(this.start);
this.panelSouth.add(this.preview);
this.panelSouth.add(this.set);
this.myCanvas = new MyCanvas();
this.container.add(this.myCanvas, "Center");
this.container.add(this.panelSouth, "South");
setTitle("火影拼图");
setLocation(300, 200);
setSize(308, 365);
setResizable(false);
setVisible(true);