How can I add an image to every row in a TableView with JavaFX using labda expressions? -
i have initialize methode:
@fxml private void initialize() { titulocolumna.setcellvaluefactory(celldata -> celldata.getvalue() .tituloproperty()); imagencolumna.setcellvaluefactory(celldata -> celldata.getvalue() .imagenproperty()); // manejar evento dobleclick y enter sobre una receta para mostrar-la tablarecetas.setonmousepressed((event) -> { if (event.isprimarybuttondown() && event.getclickcount() == 2) { manejareditarreceta(); } }); tablarecetas.setonkeypressed((event) -> { if (event.getcode() == keycode.enter) { manejareditarreceta(); } }); }
and need change string path of "imagen" of second column image, in order show both, name , image @ same row.
the code link lambda expresion:
public class listarecetascelda extends tablecell<string,receta>{ private imageview view = new imageview(); @override protected void updateitem(receta item, boolean empty) { super.updateitem(item, empty); if (item != null) { view.setimage(item.getfoto()); setgraphic(view); //settext(item.getnombre()); } else { //settext(null); setgraphic(null); } } }
Comments
Post a Comment