QUOTE(pbl @ 3 Sep, 2008 - 04:13 AM)

You're class Druid extends JLabel that means 1 JLabel not an array of 5 JLabel
You probably want something like this (there is a lot of method you do not need to overload)
and as they go into a Combo you don't need X and Y, neither do you have to repaaint
CODE
package Driud;
import java.awt.Graphics;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
public class Druids extends JLabel
{
ImageIcon icon;
Druids(String filename) {
super("")
icon = new ImageIcon(filename);
}
Now the one who calls this:
CODE
String Druidrray[]={"Clarion.gif","Pan.gif","Rhino.gif","Wonde.gif","Pluto.gif"};
for(int i = 0; i < druids.length; i++) {
combo.addItem(new Druids(Druidrray[i]);
}
As it goes in a Combo it is JComboBox that I would extends:
CODE
class DruidCombo extends JCombo {
DruidCombo() {
super();
for(int i = 0; i < Druidrray.length; i++)
addItem(new JLabel(new ImageIcon(Druidrray[i])));
}
}
QUOTE(pbl @ 3 Sep, 2008 - 04:13 AM)

You're class Druid extends JLabel that means 1 JLabel not an array of 5 JLabel
You probably want something like this (there is a lot of method you do not need to overload)
and as they go into a Combo you don't need X and Y, neither do you have to repaaint
CODE
package Driud;
import java.awt.Graphics;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
public class Druids extends JLabel
{
ImageIcon icon;
Druids(String filename) {
super("")
icon = new ImageIcon(filename);
}
Now the one who calls this:
CODE
String Druidrray[]={"Clarion.gif","Pan.gif","Rhino.gif","Wonde.gif","Pluto.gif"};
for(int i = 0; i < druids.length; i++) {
combo.addItem(new Druids(Druidrray[i]);
}
As it goes in a Combo it is JComboBox that I would extends:
CODE
class DruidCombo extends JCombo {
DruidCombo() {
super();
for(int i = 0; i < Druidrray.length; i++)
addItem(new JLabel(new ImageIcon(Druidrray[i])));
}
}