Я следовал этому уроку: https://docs.oracle.com/javafx/2/fxml_get_started/fxml_tutorial_intermediate.htm#CACFHDEJ
И мое первое заполнение TableView просто отлично.Но мой второй на другом этапе нет.Я получаю сообщение об ошибке: «javafx.fxml.LoadException: PropertyValueFactory не является допустимым типом».* Everytimeвыглядит следующим образом:
/*
* To change this license header, choose License Headers in Project
Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package MainGui;
import algorithm.ObjectValuePair;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.ResourceBundle;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import org.json.simple.JSONObject;
/**
* FXML Controller class
*
* @author
*/
public class DetailViewController implements Initializable {
@FXML
private TextField txtfdName;
@FXML
private TextField txtfdGroup;
@FXML
private TextField txtfdSecGroup;
@FXML
private TextField txtfdTel;
@FXML
private TextField txtfdFax;
@FXML
private TextField txtfdStreet;
@FXML
private TextField txtfdNumber;
@FXML
private TextField txtfdPlz;
@FXML
private TextField txtfdCity;
@FXML
private TextField txtfdWebsite;
@FXML
private TextField txtfdMail;
@FXML
private TextField txtfdBdl;
private String title;
private DetailedCustomer dc;
@FXML
private AnchorPane ap;
@FXML
private TableView<PartnerOverview> tblData;
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
}
@FXML
private void onActionChange(ActionEvent event) {
}
public void setDetailedCusotmerBasics(String id, JsonDatabaseConnector jdc){
dc = new DetailedCustomer(id, jdc);
this.txtfdBdl.setText(dc.getBdl());
this.txtfdName.setText(dc.getName());
this.txtfdGroup.setText(dc.getGroup());
this.txtfdSecGroup.setText(dc.getSubGroup());
this.txtfdTel.setText(dc.getTel());
this.txtfdFax.setText(dc.getFax());
this.txtfdStreet.setText(dc.getStreet());
this.txtfdNumber.setText(dc.getHnr());
this.txtfdPlz.setText(dc.getPlz());
this.txtfdCity.setText(dc.getCity());
this.txtfdWebsite.setText(dc.getSite());
this.txtfdMail.setText(dc.getMail());
/*ArrayList<JSONObject> search = dc.getPartner();
if(search != null){
int size = search.size();
for(int i = 0; i < size; i++){
ObservableList<PartnerOverview> data = tblData.getItems();
data.add(new PartnerOverview(search.get(i)));
}
}*/
ObservableList<PartnerOverview> data = tblData.getItems();
data.add(new PartnerOverview("awd", "awd", "adw", "awd", "adw", "awd", "adw", "awd"));
}
}
И мой PartnerOverview выглядит так:
/*
* To change this license header, choose License Headers in Project
Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package MainGui;
import javafx.beans.property.SimpleStringProperty;
import org.json.simple.JSONObject;
/**
*
* @author
*/
public class PartnerOverview {
private SimpleStringProperty firstName = new SimpleStringProperty("");
private SimpleStringProperty name = new SimpleStringProperty("");
private SimpleStringProperty position = new SimpleStringProperty("");
private SimpleStringProperty tel = new SimpleStringProperty("");
private SimpleStringProperty mobil = new SimpleStringProperty("");
private SimpleStringProperty mail = new SimpleStringProperty("");
private SimpleStringProperty bday = new SimpleStringProperty("");
private SimpleStringProperty hobby = new SimpleStringProperty("");
public PartnerOverview(){
this("","","","","","","","");
}
public PartnerOverview(String firstName, String name, String position, String tel, String mobil, String mail, String bday, String hobby){
this.firstName.set(firstName);
this.name.set(name);
this.position.set(position);
this.tel.set(tel);
this.mobil.set(mobil);
this.mail.set(mail);
this.bday.set(bday);
this.hobby.set(hobby);
}
public PartnerOverview(JSONObject obj){
this.firstName.set((String) obj.get("Vorname"));
this.name.set((String) obj.get("Name"));
this.position.set((String) obj.get("Funktion"));
JSONObject address = (JSONObject) obj.get("Adresse");
this.tel.set((String) address.get("Durchwahl"));
this.mobil.set((String) address.get("MobilTel"));
this.mail.set((String) address.get("eMail"));
this.bday.set((String) address.get("Geburtstag"));
this.hobby.set((String) address.get("Hobbys"));
}
public String getFirstName() {
return firstName.get();
}
public void setFirstName(String firstName) {
this.firstName.set(firstName);
}
public String getName() {
return name.get();
}
public void setName(String name) {
this.name.set(name);
}
public String getPosition() {
return position.get();
}
public void setPosition(String position) {
this.position.set(position);
}
public String getTel() {
return tel.get();
}
public void setTel(String tel) {
this.tel.set(tel);
}
public String getMobil() {
return mobil.get();
}
public void setMobil(String mobil) {
this.mobil.set(mobil);
}
public String getMail() {
return mail.get();
}
public void setMail(String mail) {
this.mail.set(mail);
}
public String getBday() {
return bday.get();
}
public void setBday(String bday) {
this.bday.set(bday);
}
public String getHobby() {
return hobby.get();
}
public void setHobby(String hobby) {
this.hobby.set(hobby);
}
}
Я не вижу никаких проблем, и раньше он работал на моем другом классе fxml.Кто-нибудь может помочь?