私我源码

主函数调用入口MainPro
//主函数调用窗口
public class MainPro {
public static void main(String[] args) {
MyFrame myFrame = new MyFrame();
}
}
创建图片JImage
import javax.swing.*;
import java.util.Random;
//创建图片
public class JImage extends JPanel {
public ImageIcon computerSrc;
public ImageIcon playerSrc;
public JLabel jLabel1;
public JLabel jLabel2;
public JImage(){
jLabel1 = new JLabel();
jLabel2 = new JLabel();
computerSrc = new ImageIcon("./images/剪刀.png");
playerSrc = new ImageIcon("./images/剪刀.png");
jLabel1.setIcon(computerSrc);
jLabel2.setIcon(playerSrc);
add(jLabel1);
add(jLabel2);
// setVisible(true);
}
//设置随机数变换电脑的 出拳
public void playGame(){
//设置随机数种子
Random random = new Random();
int nowIndex = random.nextInt(3);
if (nowIndex==0){
computerSrc = new ImageIcon("./images/石头.png");
}else if (nowIndex==1){
computerSrc = new ImageIcon("./images/剪刀.png");