I get this error.
/*array dimension missing
new ImageIcon [] = getClass().getResource(name[0]),*/
^
and I dunno what's missing. and not sure if anything else is wrong because for now there are 4 erros for
name[0],name[1],name[3],name[4]
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.Container;
import java.io.IOException;
import java.io.*;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
public class exam extends JFrame
{
public static JComboBox imagesJComboBox ;
public static JLabel label;
private String[] name = {"6.gif", "pikachu.gif", "kissplz.gif" , "mwah.gif"};
private ImageIcon[] icons = {
new ImageIcon [] = getClass().getResource(name[0]),
new ImageIcon [] = getClass().getResource(name[1]),
new ImageIcon [] = getClass().getResource(name[2]),
new ImageIcon [] = getClass().getResource(name[3])
};
public exam()
{
super ();
setLayout(new FlowLayout());
label = new JLabel(icons);
imagesJComboBox = new JComboBox ();
imagesJcomboBox.setMaximumRowCount(4);
imagesComboBox.addActionListener (new ActionListener());
label.addActionListener(new ActionListener());
add (imagesJComboBox);
label = new JLabel (icons.index[0]);
add (label);
}
public void itemStateChange (ActionEvent e)
{
if (e.getStateChange () == ActionEvent.SELECTED)
label.setIcon(icons( imagesJComboBox.getSelectedIndexes()));
}
public static void main(String [] args)
{ exam x = new exam();}
}