• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to change the row color

 
Tripti srivastava
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Experts,
I am trying to changes the color of few rows into red.
Tried following code for that. but it doesn't work.

private Recordset rst = null;
private Connection dbs = null;
int NewSqlCount=0;


{

rst = dbs.openRecordset( "SELECT * FROM CRVMReq " +
"where [Priority] like '" +Highest Priority + "%' " +
"AND ReqStatus like 'OPEN' " +
"and ReqStatusPool NOT like 'FOCUS' " +
“and ReadyTD like'YES'”+
"", AdoConst.adOpenDynamic, 0 );

if( rst.getRecordCount()>0 )
{
NewSqlCount=rst.getRecordCount();

For(int i=0;i<NewSqlCount ; i++)
{

ListCRVM.setForeground( Color.red ); //The problem is at this point.I don't know at this point how i will force to change the color of that rowset only.I hope there must be some propertry of recordset}
}
Else
{
NewSqlCount=0;
ListCRVM.setForeground( Color.black );
}

}

{

rst = dbs.openRecordset(select * from CRVMReq where priority!='Highest Priority' and ReqStatus like 'OPEN' and ReqStatusPool not like 'FOCUS'and ReadyTD='YES'+"", AdoConst.adOpenDynamic, 0 );


if( rst.getRecordCount()>0 )
{

NewSqlCount=rst.getRecordCount();

For(int i=0;i<NewSqlCount ; i++)
{

ListCRVM.setForeground( Color.black );
}

}
Else
{
NewSqlCount=0;
ListCRVM.setForeground( Color.black );
}
}
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> I am trying to changes the color of few rows into red.

few rows of what?
JList
JComboBox
JTable
Other

generally done via a custom renderer

find the component you're working with under the "How To ..." section,
and there should be a working example

http://java.sun.com/docs/books/tutorial/uiswing/TOC.html
 
Tripti srivastava
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public MultiColumnListBox ListCRVM = new MultiColumnListBox();
 
Rob Spoor
Sheriff
Pie
Posts: 20608
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For us not familiar with MultiColumnListBox, which framework or library is it part of?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic