I want to have a ListView with the name of the "Persons", but on the ListView when I launch the application, I see some weird strings instead of the (string)names. I think it is a cast problem of the "Person"-object. I didnt know if the ListView should be ListView or ListView. Because when I try to set the items on the listview, using setItems(ObservableList) i get that weird Strings on list shown.. here is the code:
MainApp.java:
public static ObservableList<Person> personList;
public static void main(String[] args) {
personList = FXCollections.observableArrayList();
Person p1 = new Person("Tom");
Person p2 = new Person("Anna");
personList.add(p1);
personList.add(p2);
launch(args);
}
PersonController.java:
import static ordercheck.OrderCheck.personList;
public class PersonalController implements Initializable {
@FXML
private ListView<Person> personalList;
public void initialize(URL url, ResourceBundle rb) {
personalList.setItems(personList);
....
....
}
....
....
}
how could I see the real names and not such strings: ordercheck.model.Person@2c5ds8dsf8sdf8
Thank you!