View Single Post
  #1 (permalink)  
Old 02-03-2008, 03:58 PM
Cymro Cymro is offline
Member
 
Join Date: Jan 2008
Posts: 7
Cymro is on a distinguished road
ArrayList problem with images
I have this code:
Code:
public static ArrayList<ImageIcon> imRay = new ArrayList<ImageIcon>(); ImageIcon one = new ImageIcon("0.png"); ImageIcon two = new ImageIcon("1.png"); public Test() { initComponents(); this.setLocationRelativeTo(null); imRay.add(one); imRay.add(two); }
Then, later on, under a button:

Code:
int i = 0; i = jComboBox1.getSelectedIndex(); jLabel3.setIcon(imRay.get(i));
However, whilst it doesn't throw an error (unless I select a value in the jComboBox that is higher than currently allowed), it doesn't change the icon in jlabel3.

Where am I going wrong?
Reply With Quote
Sponsored Links