cpraveenbabu
September 18th, 2000, 11:27 PM
Hi,
Im not getting different icons for different
files in a tree.
setLeafIcon() changes all files to the same color
My code is
for(int i=0;i<list.length;i++)
{
if (list[i].equals("receiver") )
{
renderer.setLeafIcon(new ImageIcon("green.gif")
);
> > > setCellRenderer(renderer);
> > > }
> > > else if (list[i].equals("transmitter"))
> > > {
> > > renderer.setLeafIcon(new
> > > ImageIcon("redfile.gif") );
> > > setCellRenderer(renderer);
> > > }
> > > else if (list[i].equals("recupdated"))
> > > {
> > > renderer.setLeafIcon(new
> > > ImageIcon("bluefile.gif") );
> > > setCellRenderer(renderer);
> > > }
> > > else if (list[i].equals("transupdated"))
> > > {
> > > renderer.setLeafIcon(new
> > > ImageIcon("yellowfile.gif") );
> > > setCellRenderer(renderer);
> > > }
> > > }
> > >
For each condition it checks, it changes
> all
> > > icons to the same
> > > color.So if the last file is "transupdated" all
> the
file icons change color
to yellowfile.gif
Try giving me a solution ..and if possible make changes in the particular code and send it
Best Regards,
Praveen.C
When going gets tough,
Tough gets going.
Im not getting different icons for different
files in a tree.
setLeafIcon() changes all files to the same color
My code is
for(int i=0;i<list.length;i++)
{
if (list[i].equals("receiver") )
{
renderer.setLeafIcon(new ImageIcon("green.gif")
);
> > > setCellRenderer(renderer);
> > > }
> > > else if (list[i].equals("transmitter"))
> > > {
> > > renderer.setLeafIcon(new
> > > ImageIcon("redfile.gif") );
> > > setCellRenderer(renderer);
> > > }
> > > else if (list[i].equals("recupdated"))
> > > {
> > > renderer.setLeafIcon(new
> > > ImageIcon("bluefile.gif") );
> > > setCellRenderer(renderer);
> > > }
> > > else if (list[i].equals("transupdated"))
> > > {
> > > renderer.setLeafIcon(new
> > > ImageIcon("yellowfile.gif") );
> > > setCellRenderer(renderer);
> > > }
> > > }
> > >
For each condition it checks, it changes
> all
> > > icons to the same
> > > color.So if the last file is "transupdated" all
> the
file icons change color
to yellowfile.gif
Try giving me a solution ..and if possible make changes in the particular code and send it
Best Regards,
Praveen.C
When going gets tough,
Tough gets going.