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

