i am trying to populate data into my tableview everything seems fine but still it is not showing data. here is the code. everything seems to be fine but the tableview is not showing anything. not even blinking...
public class MainPage implements Initializable {
@FXML
private AnchorPane root;
@FXML
private Button main_LogOut;
@FXML
private ComboBox<?> main_Clients;
@FXML
private ComboBox<?> main_Users;
@FXML
private TableView<customerDetails> table;
@FXML
private TableColumn<customerDetails, String> clientId;
@FXML
private TableColumn<customerDetails, String> clientName;
@FXML
private TableColumn<customerDetails, String> clientEmail;
@FXML
private TableColumn<customerDetails, String> clientRequirement;
@SuppressWarnings("unchecked")
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
// TODO Auto-generated method stub
clientId.setCellValueFactory(new PropertyValueFactory<customerDetails,String> ("Id"));
clientName.setCellValueFactory(new PropertyValueFactory<customerDetails, String>("name"));
clientEmail.setCellValueFactory(new PropertyValueFactory<customerDetails, String>("email"));
clientRequirement.setCellValueFactory(new PropertyValueFactory<customerDetails, String>("Requirements"));
table=new TableView<customerDetails>();
table.setItems(getClients());
table.getColumns().addAll(clientId,clientName,clientEmail,clientRequirement);
}
@FXML
void loadScene(ActionEvent event) throws IOException
{
AnchorPane pane=FXMLLoader.load(getClass().getResource("/lists/MainPage.fxml"));
root.getChildren().setAll(pane);
}
public ObservableList<customerDetails> getClients()
{
ObservableList<customerDetails> cd=FXCollections.observableArrayList();
customerDetails details=new customerDetails("moin123","moeen","789987","asdf","email","developer","abcd","adsadasdf","78987");
cd.add(details);
return cd;
}
and the customers model..... i don't know if there is anything wrong with the getter setters. I have read some times there is issues with PropertyValueFactory. But here I would appreciate a little help.
public class customerDetails implements Serializable{
private String Id;
private String name;
private String phone_Number;
private String current_Address;
private String job_Title;
private String Company;
private String Requirements;
private String annual_Salary;
private String email;
public customerDetails()
{
}
public customerDetails(String c_id, String Name, String number, String curr_Add, String j_Title, String company, String req, String salary,String e_mail)
{
this.Id=c_id;
this.name=Name;
this.phone_Number=number;
this.current_Address=curr_Add;
this.job_Title=j_Title;
this.Company=company;
this.Requirements=req;
this.annual_Salary=salary;
this.email=e_mail;
}
public String getId() {
return Id;
}
public void setId(String id) {
Id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone_Number() {
return phone_Number;
}
public void setPhone_Number(String phone_Number) {
this.phone_Number = phone_Number;
}
public String getCurrent_Address() {
return current_Address;
}
public void setCurrent_Address(String current_Address) {
this.current_Address = current_Address;
}
public String getJob_Title() {
return job_Title;
}
public void setJob_Title(String job_Title) {
this.job_Title = job_Title;
}
public String getCompany() {
return Company;
}
public void setCompany(String company) {
Company = company;
}
public String getRequirements() {
return Requirements;
}
public void setRequirements(String requirements) {
Requirements = requirements;
}
public String getAnnual_Salary() {
return annual_Salary;
}
public void setAnnual_Salary(String annual_Salary) {
this.annual_Salary = annual_Salary;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
any idea what is wrong here?