I have a tableview and in one column I would like to be able to indvidually color each character of the string. Apparently, textFill only works on the entire cell, as I did try splitting the string by characters first. I've included the code below which does not quite do as I wish, but is indicative (it changes the cell text color based only upon the first character). How can I adjust to get a multicolored output in that cell? [note: the unicode characters are up and down arrows]
val colTick = new TableColumn[Quote, String] {
editable = false
text = "Tick"
prefWidth = 90
alignmentInParent = scalafx.geometry.Pos.Center
cellFactory = { _ =>
new TableCell[Quote, String] {
item.onChange { (_, _oldTick, newTick) =>
if (newTick == null) {
text = null
graphic = null
} else {
if (newTick(0) == '\u2B06') {
textFill = Color.Green
} else {
if (newTick(0) == '\u2B07') textFill = Color.Red else textFill = Color.Black
}
text = newTick
}
}
}
}
cellValueFactory = {
_.value.tick
}
}