I have 30 ImageIcons that I have declared in a ImageIcon array. I have declared them all using a FOR loop. THe only problem is that when I try to add the ImageIcon to a JLabel and display the JPanel on the screen, it doesn't work.Here is my code:
package screens;
import javax.swing.*;
import java.awt.*;
public class gameScreen extends JPanel {
private static final long serialVersionUID = 1L;
// -------------VARIABLES---------------//
Image wallpaper = (Image)Toolkit.getDefaultToolkit().getImage(getClass().getResource("images/wallpaper.jpg"));
ImageIcon[] teamsImg = new ImageIcon[30];
public gameScreen() {
for(int i = 0;i>30;i++){
teamsImg[i] = new ImageIcon(Toolkit.getDefaultToolkit().getImage(
getClass().getResource("images/img.png")));
}
JLabel label = new JLabel(teamsImg[27]);
add(label);
}
// -------------PAINT FUNCTION----------//
public void paintComponent(Graphics g) {
g.drawImage(wallpaper,0,0,null);
}
}

super.paintXxx, the paint methods do a lot of important work that you should not neglect unless you a have a very, Very, VERY good reason to. ps I doubt that's your problem, but that just annoys me :P