java - JavaFX Tables - Adding columns works but no text -


i have searched everywhere (including youtube videos) , couldn't find answer.

i have simple code partially works:

@fxml private tableview<model.location> locationstable; @fxml observablelist<model.location> locationslist = fxcollections.observablearraylist();  public void initialize(url location, resourcebundle resources) {      locationslist.add(new model.location("123", "123", "123"));     locationslist.add(new model.location("321", "123", "123"));     locationslist.add(new model.location("abc", "123", "123"));      system.out.println(locationslist);      // locationid column     tablecolumn<model.location, string> columnlocationid = new tablecolumn<model.location, string>();     columnlocationid.settext("id");     columnlocationid.setminwidth(104);     columnlocationid.setcellvaluefactory(new propertyvaluefactory<model.location, string>("locationid"));      // address column     tablecolumn<model.location, string> columnaddress = new tablecolumn<model.location, string>();     columnaddress.settext("address");     columnaddress.setminwidth(104);     columnaddress.setcellvaluefactory(new propertyvaluefactory<model.location, string>("address"));      locationstable.getcolumns().addall(columnlocationid, columnaddress);     locationstable.setitems(locationslist); } 

the columns added. text doesn't show up.
checked , array (locationslist) has objects.

here location class:

//***************************************** variables ********************************************* /**location's id (key)*/ private final string locationid;   /**locations's address*/ private final string address; /**locations's description*/ private string description; /**locations's assigned vehicle*/ private vehicle carassignedtolocation; /**reservations associated location*/ private hashmap<string, reservation> reservations; //***************************************** constructors ****************************************** /**  * constructor of location object assigned car null.  * @param locationid  * @param address  * @param description  */ public location(string locationid, string address, string description) {     this.locationid = locationid;     this.address = address;      this.setdescription(description);     this.setcarassignedtolocation(null);     reservations = new hashmap<string, reservation>(); } 

i'm out of mind trying figure out, appreciated!

try: locationstable.getitems().addall(locationslist); instead of locationstable.setitems(locationslist);


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -