I use nearly that way but using CSS, some ECS tags have CLASS element.


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Stephan Nagy
Sent: Tuesday, March 13, 2001 5:23 PM
To: [EMAIL PROTECTED]
Subject: Re: Alternating BGCOLOR for rows in a table


"RESTREPO, ALEXANDER G [Non-Pharmacia/1000]" wrote:

> Hi:
>
> I want to change the color of table rows after I
> create my table object.
>
> I want to do this after I create my table object
> in order to allow an HTML developer the ability to
> modify the characteristic of how a table looks without
> knowing too much about ECS...
>
> Is there a simple way to specify alternate colors for
> table rows? For example, all odd rows are red and
> all even rows are blue.
>
> Any ideas would be greatly appreciated.

An inelegant way would be.

int x = 1;
Enumeration keys = table.keys();
while(keys.hasNextElement())
{
    if(x%2 != 0)

((TR)table.getElement((String)keys.nextElement()).setBgColor(HtmlColor.RED);

    else

((TR)table.getElement((String)keys.nextElement()).setBgColor(HtmlColor.BLUE)
;

    x++;
}

That should work i didn't try and compile it but you get the general
idea.

-stephan


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to