文档介绍:import . BorderLayout ; import . Button ; import . Choice ; import . Color ; import . Container ; import . ActionEvent ; import . ActionListener ; import ; import ; import ; import ; import ; import ; 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 ("开始" ); ( this ); preview= new Button ("预览" ); ( this ); set = new Button ("设置" ); ( this ); panelPreview= new JPanel(); ( null ); Icon icon= new ImageIcon( "pictrue/pic_" ++ ".jpg" ); JLabel label= new JLabel(icon); (0,0,300,300); (label); panelNorth= new JPanel(); ( Color .red); (start); (preview); (set); myCanvas= new MyCanvas(); (myCanvas, BorderLayout .CENTER); (panelNorth, BorderLayout .NORTH); this .setTitle( "拼图小游戏-明" ); this .setLocation(300,200); this .setSize(308,365); this