So I have a list which is full of names from my database. Those names represent employees that work or used to work in the firm. I've seen that is possible to change cell's text color but when I apply it, it changes all of them. What I really want is to change color of the clients that are no more working.
I've added "not active" in List so I can separate "active" and "not active" clients.
Here is the code where I add employees names in the ArrayList:
public ArrayList<String> search(String unit, String name)
{
ArrayList<String> temp= new ArrayList<String>();
String sql="";
if(unit=="all units")
sql="SELECT * FROM employees WHERE name='"+name+"';";
else
sql="SELECT * FROM employees WHERE unit='"+unit+"' AND name='"+name+"';";
try {
ResultSet rs=bp.select(sql);
while(rs.next())
{
if(rs.getInt("active")==1)
temp.add(rs.getString("name"));
else
temp.add(rs.getString("name")+" - not active");
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Collections.sort(temp);
return temp;
}
And here is the code where I add that ArrayList in my ListView:
for (String item: u.search(unitCB.getValue(),nameTF.getText()))
SearchLW.getItems().add(item);
Now, I wounder is it possible to change text-color in this list using css to red for all employees that are not active anymore? If it's not, another solution on how to change this specific ListView cell's text-color would be helpful.