creating a JTable of JLabels presented in a JScrollPane()

Hi, I want to create an object showing all/some colored labels. I get it presented with 5 columns, but nothing is colored. Her is a part of the logic:

public MyColorTableModel()

{

// String [][] array;

array = new JLabel [280][10]; //Just for test purposes

int row=0;

int col=0;

String cc;

JLabel lbl;

for (r=0; r<256; r++)

{

System.out.println("Red number is : " + r);

for (g=0; g<256; g++)

{

System.out.println("Green number is: " + g);

for (b=0; b<256; b++)

{

cc = ("R= "+r+" G= "+g+" B= "+b);

lbl = new JLabel(cc);

lbl.setOpaque(true);

lbl.setBackground(new Color(r, g, b));

array[row] [col] = lbl; //Is this the problem?

if (col==4)

{

col=-1;

row++;

}

col++;

}

r=600; g=600;//Force stop

}

}

Thanks

tjoge01

[940 byte] By [Tjoge01a] at [2007-10-3 4:32:10]
# 1
Totally the wrong way of going about it, using exactly what JTable is designed to avoid (ie huge numbers of components).Read this, http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#renderer
itchyscratchya at 2007-7-14 22:35:40 > top of Java-index,Desktop,Core GUI APIs...
# 2
Thanks for your answer..
Tjoge01a at 2007-7-14 22:35:40 > top of Java-index,Desktop,Core GUI APIs...