Servis-Rhino 4211B Guía de usuario Pagina 274

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 298
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 273
be set to any nodes you like which will then appear in the table.
Again, a TableColumn has a CellFactory and a CellFactory returns a TableCell and
a TableCell knows how to render a cell.
An example of coding a setCellFactory() would then be:
actionsColumn.setCellFactory(new Callback<TableColumn<SearchResult, String>,TableCell<SearchResult,
String>>() {
@Override
public TableCell<SearchResult, String> call(TableColumn<SearchResult, String> column) {
final TableCell<SearchResult, String> cell = new TableCell<SearchResult, String>();
Button button = new Button("Hello");
cell.setGraphic(button);
return cell;
}
});
Using Java 8 Lambdas, we might have something like:
linesTableColumn.setCellFactory(tableColumn -> new TableCell<String, String>() {
@Override
public void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
if (!isEmpty()) {
setTextFill(Color.BLACK);
setStyle(null);
setFont(font);
setText(item);
} // End !is empty
} // End of updateItem
}); // End of setCellFactory
TableCell objects are re-used. There is not a TableCell object for event cell in a column.
Instead the TableView manages to create only those that are needed to show the table.
Let us take a different, but equally valid pass at describing the nature of the TableCell.
Imagine we have an array of data. That is illustrated in the following image. Do not confuse this
image with a table … it is meant to say we have an array of data.
Page 274
Vista de pagina 273
1 2 ... 269 270 271 272 273 274 275 276 277 278 279 ... 297 298

Comentarios a estos manuales

Sin comentarios