0
如何顯示我存儲在JPanel的arraylist中的jpg圖像?我不能在JPanel中顯示jpg文件。在JPanel上顯示jpg圖像
String[] pictureFile = {"A.jpg","B.jpg","C.jpg"};
List<String> picList1 = Arrays.asList(pictureFile);
Collections.shuffle(picList1);
ImageIcon icon = new ImageIcon("picList1.get(0)");
JLabel label1 = new JLabel();
label1.setIcon(icon);
JPanel panel = newJPanel;
panel.add(label);
謝謝...它的工作:-) – Jessy 2009-11-01 17:47:42