Well, I created a custom TableCell for my TableView. This custom TableCell contains a Link and opens the browser when clicked. Everything is working fine, what I want to do is change the text color of this TableCell when it is selected... This is what I am trying to do:
callback = new Callback<TableColumn, TableCell>(){
@Override
public TableCell call(TableColumn param) {
return new TableCell<Test, String>(){
EventHandler handler = new EventHandler<MouseEvent>() {
final AM_RSS_FX RSS = AM_RSS_FX.this;
@Override
public void handle(MouseEvent param) {
try {
java.awt.Desktop.getDesktop().browse(new URI(RSS.link));
} catch (IOException | URISyntaxException ex) {
Logger.getLogger(AM_RSS_FX.class.getName()).log(Level.SEVERE, null, ex);
}
}
};
@Override
public void updateItem(String item, boolean empty){
super.updateItem(item, empty);
if(!isEmpty()){
final AM_RSS_FX RSS = AM_RSS_FX.this;
this.setTextFill(Color.BLUE);
setText(item);
RSS.link = this.getText();
this.addEventHandler(MouseEvent.MOUSE_CLICKED, handler);
}
}
@Override
public void updateSelected(boolean arg0){
super.updateSelected(arg0);
if(isSelected()){
this.setTextFill(Color.AQUA);
}
}
};
}
};
I don't know which method i need to Override =/ I tried to Override the updateSelected, but didn't worked =/
Can someone help me?