//為什麼圖片都跑不出來
package ston;
import javax.swing.*;
public class label extends JFrame{
private JPanel contentpane;
private JLabel[] lbl = new JLabel[2];
private ImageIcon[] icon = new ImageIcon[3];
String []apple =new String[] {"剪刀","石頭","布"};
label(){
setSize(1500,2000);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
contentpane = new JPanel();
setContentPane(contentpane);
contentpane.setLayout(null);
for(int i = 0; i<3; i++){
icon[i] = new ImageIcon("C:/java/ston/bin"+apple[i]+".jpg");
}
for(int i = 0; i<2; i++){
lbl[i] = new JLabel();
lbl[i].setBounds(i*200 +20, 20, 500, 300);
lbl[i].setIcon(icon[i]);
contentpane.add(lbl[i]);
}
setVisible(true);
}
public static void main(String[] args) {
label label = new label();
}
}