set JavaFX Table Column Value - Java JavaFX

Java examples for JavaFX:Table

Description

set JavaFX Table Column Value

Demo Code


    //package com.java2s;
    import javafx.beans.property.SimpleObjectProperty;
    import javafx.scene.control.TableColumn;

    import java.util.function.Function;

    public class Main {
        public static <S, T> void setColumnValue(final TableColumn<S, T> column,
    final Function<? super S, ? extends T> f)
{
    column.setCellValueFactory(//w  ww  .  j a v  a  2 s  . c om
        param -> new SimpleObjectProperty<T>()
        {
            @Override
            public T get()
            {
                return f.apply(param.getValue());
            }
        }
    );
}
    }

Related Tutorials