View Single Post
Old 12-30-2012, 07:31 PM   PM User | #3
Atlan
New Coder

 
Join Date: Jul 2012
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
Atlan is an unknown quantity at this point
I tried using a loop, but I ran into a problem.

Code:
for(int wb = 0; wb < 60; wb++)
			 {
				 arsenalSel[wb].addActionListener(new ActionListener()
				 {
					 public void actionPerformed(ActionEvent e)
					 {
						System.out.println("" +wMaster.allWeapons[wb].name);
					 }
				 });
			 }
It won't let me refer to wb, because it's not a 'final'. If I change wb TO final, the rest of the code breaks. The next actionlistener stops working, with eclipse saying it's 'Unreachable Code'.

Any idea how to fix that?
Atlan is offline   Reply With Quote