• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cell Renderer Question

 
orey sattiga
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am trying to something like this in a cell renderer....
int a,b,c;
if ( a < b )
{
change to bold red
}
if ( a < c)
{
change to red
}
if both the above are met
change to bold red
Cell renderer seems to pick up the first condition if me and not checking the rest..
so if a < b it is changing the cell to bold red
and not checking the other two conditions
even though they might be true.
Thanks
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I must have missed something in your post. If the 1st condition is met it is bold red if both are met it is bold red. You say it isn't doing all checks? It is bold red isn't it?
 
orey sattiga
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul,
Thanks For replying..
I guess my logic was messed up.
I was actually trying to do this...
if(a < b)
{
if (a < c)
{
System.out.println(" Bold red");
}else
{
System.out.println(" Bold red");
}
}else if(a < c)
{
System.out.println(" Red");
}
 
orey sattiga
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My indentation did not show up correctly in the previous post
if( a < b)
{
if (a < c)
{
System.out.println(" bold red");
}else
{
System.out.println(" bold red");
}
}else if(a < c)
{
System.out.println(" red");
}
 
orey sattiga
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i guess i have to use the code tag
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is what that code says to do. If a is less than b, set to bold red (That extra "if" within there doesn't do anything since both paths set to bold red). If a is greater than b, check to see if it is less than c. If so, set to red. If a is greater than c, don't change anything.
What is it that you want it to do?
 
orey sattiga
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul,
Ok here is what i want
if a < b change to bold red
if a < c change to red
BUT IF both the above conds are met
change to bold red.
so i put it in the nested if
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if a < b bold red
else if a < c red
That covers your requirements. The both part does not matter since it should be bold red any time a < b.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!