1

So i have a Person class:

package tableview;

import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty;

public class Person {

private SimpleStringProperty name;

private SimpleBooleanProperty smart;

public Person(String name, boolean smart) {
    this.name = new SimpleStringProperty(name);
    this.smart = new SimpleBooleanProperty(smart);
}

public SimpleStringProperty getName() {
    return name;
}

public void setName(SimpleStringProperty name) {
    this.name = name;
}

public SimpleBooleanProperty getSmart() {
    return smart;
}
}

and this is how i add them to the ObservableList of Persons

        person.add(new Person("Emre", false));

and this is how i set the CellValueFactory

        nameColumn.setCellValueFactory(new PropertyValueFactory<Person, String>("name"));

and these are the columns

@FXML
public TableColumn<Person, String> nameColumn;

@FXML
public TableColumn<Person, Boolean> smartColumn;

But it shows this on the table view

screenshot of result

is there anyway to show the string for the name?

Amiel Martin
  • 4,636
  • 1
  • 29
  • 28
Kiraged
  • 519
  • 2
  • 9
  • 28

1 Answers1

1

Try this

public String getName() {
    return name.get();
}

    public boolean getSmart() {
    return smart.get();
}
maimArt
  • 389
  • 1
  • 11