实战-Swing实现图片拼图
1 Swing实现图片拼图
package com.yiidian;
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
class picpuzzle2 extends JFrame implements ActionListener{
JButton b1,b2,b3,b4,b5,b6,b7,b8,b9,sample,starB;
Icon star;
Icon ic0=new ImageIcon(this.getClass().getResource("pic/starB0.jpg"));
Icon ic10=new ImageIcon(this.getClass().getResource("pic/starB10.jpg"));
Icon ic20=new ImageIcon(this.getClass().getResource("pic/starB20.jpg"));
Icon samicon1=new ImageIcon(this.getClass().getResource("pic/main.jpg"));
Icon samicon2=new ImageIcon(this.getClass().getResource("pic/main2.jpg"));
Icon samicon3=new ImageIcon(this.getClass().getResource("pic/main3.jpg"));
Icon ic1=new ImageIcon(this.getClass().getResource("pic/1.jpg"));
Icon ic2=new ImageIcon(this.getClass().getResource("pic/5.jpg"));
Icon ic3=new ImageIcon(this.getClass().getResource("pic/2.jpg"));
Icon ic4=new ImageIcon(this.getClass().getResource("pic/7.jpg"));
Icon ic5=new ImageIcon(this.getClass().getResource("pic/4.jpg"));
Icon ic6=new ImageIcon(this.getClass().getResource("pic/6.jpg"));
Icon ic7=new ImageIcon(this.getClass().getResource("pic/8.jpg"));
Icon ic8=new ImageIcon(this.getClass().getResource("pic/9.jpg"));
Icon ic9=new ImageIcon(this.getClass().getResource("pic/3.jpg"));
Icon ic11=new ImageIcon(this.getClass().getResource("pic/12.jpg"));
Icon ic12=new ImageIcon(this.getClass().getResource("pic/13.jpg"));
Icon ic13=new ImageIcon(this.getClass().getResource("pic/16.jpg"));
Icon ic14=new ImageIcon(this.getClass().getResource("pic/11.jpg"));
Icon ic15=new ImageIcon(this.getClass