having trouble trying to filter search a tableview from textfield [duplicate]









up vote
0
down vote

favorite













This question already has an answer here:



  • What is a NullPointerException, and how do I fix it?

    12 answers



  • What is a stack trace, and how can I use it to debug my application errors?

    7 answers



 Caused by: java.lang.NullPointerException
at javafx.collections.transformation.TransformationList.<init>(TransformationList.java:65)
at javafx.collections.transformation.FilteredList.<init>(FilteredList.java:66)
at sample.Cust_Controller.srch(Cust_Controller.java:554)
at sample.Cust_Controller.initialize(Cust_Controller.java:603)


my textfield is called search



private void srch()

columnFname.setCellValueFactory(cellData -> cellData.getValue().FirstNameProperty());
columnLname.setCellValueFactory(cellData -> cellData.getValue().LastNameProperty());

FilteredList<CustomerDetails> filteredData = new FilteredList<>(data, p -> true);

search.textProperty().addListener((observable, oldValue, newValue) ->
filteredData.setPredicate((Predicate<? super CustomerDetails>) (CustomerDetails csd) ->
// If filter text is empty, display all persons.
if (newValue == null );
);
// 3. Wrap the FilteredList in a SortedList.
SortedList<CustomerDetails> sortedData = new SortedList<>(filteredData);

// 4. Bind the SortedList comparator to the TableView comparator.
sortedData.comparatorProperty().bind(tableCustomer.comparatorProperty());

// 5. Add sorted (and filtered) data to the table.
tableCustomer.setItems(sortedData);




my customerdetails



public class CustomerDetails 
private final StringProperty custID;
private final StringProperty FirstName;
private final StringProperty LastName;
private final StringProperty Organization;
private final StringProperty Phone;
private final StringProperty Email;
private final StringProperty CusTypeID;
private final StringProperty CusTypeName;



public CustomerDetails(String custID, String FirstName, String LastName, String Organization, String Phone, String Email,String CusTypeID, String CusTypeName)
this.custID = new SimpleStringProperty(custID);
this.FirstName = new SimpleStringProperty(FirstName);
this.LastName = new SimpleStringProperty(LastName);
this.Organization = new SimpleStringProperty(Organization);
this.Phone = new SimpleStringProperty(Phone);
this.Email = new SimpleStringProperty(Email);
this.CusTypeID = new SimpleStringProperty(CusTypeID);
this.CusTypeName = new SimpleStringProperty(CusTypeName);


public String getcustID()
return (String)this.custID.get();


public String getFirstName()
return (String)this.FirstName.get();


public String getLastName()
return (String)this.LastName.get();


public String getOrganization()
return (String)this.Organization.get();


public String getPhone()
return (String)this.Phone.get();


public String getEmail()
return (String)this.Email.get();


public String getCustTypeID() return (String)this.CusTypeID.get();

public String getCustTypeName() return (String)this.CusTypeName.get();

public void setcustID(String value)
this.custID.set(value);


public void setFirstName(String value)
this.FirstName.set(value);


public void setLastName(String value)
this.LastName.set(value);


public void setOrganization(String value)
this.Organization.set(value);


public void setPhone(String value)
this.Phone.set(value);


public void setEmail(String value)
this.Email.set(value);


public void setCusTypeID(String value) this.CusTypeID.set(value);

public void setCusTypeName(String value) this.CusTypeName.set(value);

public StringProperty custIDProperty()
return this.custID;


public StringProperty FirstNameProperty()
return this.FirstName;


public StringProperty LastNameProperty()
return this.LastName;


public StringProperty FirstOrganizationProperty()
return this.Organization;


public StringProperty PhoneProperty()
return this.Phone;


public StringProperty EmailProperty()
return this.Email;


public StringProperty CusTypeID() return this.CusTypeID;

public StringProperty CusTypeName() return this.CusTypeName;










share|improve this question









New contributor




a p is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











marked as duplicate by fabian java
Users with the  java badge can single-handedly close java questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
16 hours ago


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • data seems to be null.
    – fabian
    16 hours ago














up vote
0
down vote

favorite













This question already has an answer here:



  • What is a NullPointerException, and how do I fix it?

    12 answers



  • What is a stack trace, and how can I use it to debug my application errors?

    7 answers



 Caused by: java.lang.NullPointerException
at javafx.collections.transformation.TransformationList.<init>(TransformationList.java:65)
at javafx.collections.transformation.FilteredList.<init>(FilteredList.java:66)
at sample.Cust_Controller.srch(Cust_Controller.java:554)
at sample.Cust_Controller.initialize(Cust_Controller.java:603)


my textfield is called search



private void srch()

columnFname.setCellValueFactory(cellData -> cellData.getValue().FirstNameProperty());
columnLname.setCellValueFactory(cellData -> cellData.getValue().LastNameProperty());

FilteredList<CustomerDetails> filteredData = new FilteredList<>(data, p -> true);

search.textProperty().addListener((observable, oldValue, newValue) ->
filteredData.setPredicate((Predicate<? super CustomerDetails>) (CustomerDetails csd) ->
// If filter text is empty, display all persons.
if (newValue == null );
);
// 3. Wrap the FilteredList in a SortedList.
SortedList<CustomerDetails> sortedData = new SortedList<>(filteredData);

// 4. Bind the SortedList comparator to the TableView comparator.
sortedData.comparatorProperty().bind(tableCustomer.comparatorProperty());

// 5. Add sorted (and filtered) data to the table.
tableCustomer.setItems(sortedData);




my customerdetails



public class CustomerDetails 
private final StringProperty custID;
private final StringProperty FirstName;
private final StringProperty LastName;
private final StringProperty Organization;
private final StringProperty Phone;
private final StringProperty Email;
private final StringProperty CusTypeID;
private final StringProperty CusTypeName;



public CustomerDetails(String custID, String FirstName, String LastName, String Organization, String Phone, String Email,String CusTypeID, String CusTypeName)
this.custID = new SimpleStringProperty(custID);
this.FirstName = new SimpleStringProperty(FirstName);
this.LastName = new SimpleStringProperty(LastName);
this.Organization = new SimpleStringProperty(Organization);
this.Phone = new SimpleStringProperty(Phone);
this.Email = new SimpleStringProperty(Email);
this.CusTypeID = new SimpleStringProperty(CusTypeID);
this.CusTypeName = new SimpleStringProperty(CusTypeName);


public String getcustID()
return (String)this.custID.get();


public String getFirstName()
return (String)this.FirstName.get();


public String getLastName()
return (String)this.LastName.get();


public String getOrganization()
return (String)this.Organization.get();


public String getPhone()
return (String)this.Phone.get();


public String getEmail()
return (String)this.Email.get();


public String getCustTypeID() return (String)this.CusTypeID.get();

public String getCustTypeName() return (String)this.CusTypeName.get();

public void setcustID(String value)
this.custID.set(value);


public void setFirstName(String value)
this.FirstName.set(value);


public void setLastName(String value)
this.LastName.set(value);


public void setOrganization(String value)
this.Organization.set(value);


public void setPhone(String value)
this.Phone.set(value);


public void setEmail(String value)
this.Email.set(value);


public void setCusTypeID(String value) this.CusTypeID.set(value);

public void setCusTypeName(String value) this.CusTypeName.set(value);

public StringProperty custIDProperty()
return this.custID;


public StringProperty FirstNameProperty()
return this.FirstName;


public StringProperty LastNameProperty()
return this.LastName;


public StringProperty FirstOrganizationProperty()
return this.Organization;


public StringProperty PhoneProperty()
return this.Phone;


public StringProperty EmailProperty()
return this.Email;


public StringProperty CusTypeID() return this.CusTypeID;

public StringProperty CusTypeName() return this.CusTypeName;










share|improve this question









New contributor




a p is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











marked as duplicate by fabian java
Users with the  java badge can single-handedly close java questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
16 hours ago


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • data seems to be null.
    – fabian
    16 hours ago












up vote
0
down vote

favorite









up vote
0
down vote

favorite












This question already has an answer here:



  • What is a NullPointerException, and how do I fix it?

    12 answers



  • What is a stack trace, and how can I use it to debug my application errors?

    7 answers



 Caused by: java.lang.NullPointerException
at javafx.collections.transformation.TransformationList.<init>(TransformationList.java:65)
at javafx.collections.transformation.FilteredList.<init>(FilteredList.java:66)
at sample.Cust_Controller.srch(Cust_Controller.java:554)
at sample.Cust_Controller.initialize(Cust_Controller.java:603)


my textfield is called search



private void srch()

columnFname.setCellValueFactory(cellData -> cellData.getValue().FirstNameProperty());
columnLname.setCellValueFactory(cellData -> cellData.getValue().LastNameProperty());

FilteredList<CustomerDetails> filteredData = new FilteredList<>(data, p -> true);

search.textProperty().addListener((observable, oldValue, newValue) ->
filteredData.setPredicate((Predicate<? super CustomerDetails>) (CustomerDetails csd) ->
// If filter text is empty, display all persons.
if (newValue == null );
);
// 3. Wrap the FilteredList in a SortedList.
SortedList<CustomerDetails> sortedData = new SortedList<>(filteredData);

// 4. Bind the SortedList comparator to the TableView comparator.
sortedData.comparatorProperty().bind(tableCustomer.comparatorProperty());

// 5. Add sorted (and filtered) data to the table.
tableCustomer.setItems(sortedData);




my customerdetails



public class CustomerDetails 
private final StringProperty custID;
private final StringProperty FirstName;
private final StringProperty LastName;
private final StringProperty Organization;
private final StringProperty Phone;
private final StringProperty Email;
private final StringProperty CusTypeID;
private final StringProperty CusTypeName;



public CustomerDetails(String custID, String FirstName, String LastName, String Organization, String Phone, String Email,String CusTypeID, String CusTypeName)
this.custID = new SimpleStringProperty(custID);
this.FirstName = new SimpleStringProperty(FirstName);
this.LastName = new SimpleStringProperty(LastName);
this.Organization = new SimpleStringProperty(Organization);
this.Phone = new SimpleStringProperty(Phone);
this.Email = new SimpleStringProperty(Email);
this.CusTypeID = new SimpleStringProperty(CusTypeID);
this.CusTypeName = new SimpleStringProperty(CusTypeName);


public String getcustID()
return (String)this.custID.get();


public String getFirstName()
return (String)this.FirstName.get();


public String getLastName()
return (String)this.LastName.get();


public String getOrganization()
return (String)this.Organization.get();


public String getPhone()
return (String)this.Phone.get();


public String getEmail()
return (String)this.Email.get();


public String getCustTypeID() return (String)this.CusTypeID.get();

public String getCustTypeName() return (String)this.CusTypeName.get();

public void setcustID(String value)
this.custID.set(value);


public void setFirstName(String value)
this.FirstName.set(value);


public void setLastName(String value)
this.LastName.set(value);


public void setOrganization(String value)
this.Organization.set(value);


public void setPhone(String value)
this.Phone.set(value);


public void setEmail(String value)
this.Email.set(value);


public void setCusTypeID(String value) this.CusTypeID.set(value);

public void setCusTypeName(String value) this.CusTypeName.set(value);

public StringProperty custIDProperty()
return this.custID;


public StringProperty FirstNameProperty()
return this.FirstName;


public StringProperty LastNameProperty()
return this.LastName;


public StringProperty FirstOrganizationProperty()
return this.Organization;


public StringProperty PhoneProperty()
return this.Phone;


public StringProperty EmailProperty()
return this.Email;


public StringProperty CusTypeID() return this.CusTypeID;

public StringProperty CusTypeName() return this.CusTypeName;










share|improve this question









New contributor




a p is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












This question already has an answer here:



  • What is a NullPointerException, and how do I fix it?

    12 answers



  • What is a stack trace, and how can I use it to debug my application errors?

    7 answers



 Caused by: java.lang.NullPointerException
at javafx.collections.transformation.TransformationList.<init>(TransformationList.java:65)
at javafx.collections.transformation.FilteredList.<init>(FilteredList.java:66)
at sample.Cust_Controller.srch(Cust_Controller.java:554)
at sample.Cust_Controller.initialize(Cust_Controller.java:603)


my textfield is called search



private void srch()

columnFname.setCellValueFactory(cellData -> cellData.getValue().FirstNameProperty());
columnLname.setCellValueFactory(cellData -> cellData.getValue().LastNameProperty());

FilteredList<CustomerDetails> filteredData = new FilteredList<>(data, p -> true);

search.textProperty().addListener((observable, oldValue, newValue) ->
filteredData.setPredicate((Predicate<? super CustomerDetails>) (CustomerDetails csd) ->
// If filter text is empty, display all persons.
if (newValue == null );
);
// 3. Wrap the FilteredList in a SortedList.
SortedList<CustomerDetails> sortedData = new SortedList<>(filteredData);

// 4. Bind the SortedList comparator to the TableView comparator.
sortedData.comparatorProperty().bind(tableCustomer.comparatorProperty());

// 5. Add sorted (and filtered) data to the table.
tableCustomer.setItems(sortedData);




my customerdetails



public class CustomerDetails 
private final StringProperty custID;
private final StringProperty FirstName;
private final StringProperty LastName;
private final StringProperty Organization;
private final StringProperty Phone;
private final StringProperty Email;
private final StringProperty CusTypeID;
private final StringProperty CusTypeName;



public CustomerDetails(String custID, String FirstName, String LastName, String Organization, String Phone, String Email,String CusTypeID, String CusTypeName)
this.custID = new SimpleStringProperty(custID);
this.FirstName = new SimpleStringProperty(FirstName);
this.LastName = new SimpleStringProperty(LastName);
this.Organization = new SimpleStringProperty(Organization);
this.Phone = new SimpleStringProperty(Phone);
this.Email = new SimpleStringProperty(Email);
this.CusTypeID = new SimpleStringProperty(CusTypeID);
this.CusTypeName = new SimpleStringProperty(CusTypeName);


public String getcustID()
return (String)this.custID.get();


public String getFirstName()
return (String)this.FirstName.get();


public String getLastName()
return (String)this.LastName.get();


public String getOrganization()
return (String)this.Organization.get();


public String getPhone()
return (String)this.Phone.get();


public String getEmail()
return (String)this.Email.get();


public String getCustTypeID() return (String)this.CusTypeID.get();

public String getCustTypeName() return (String)this.CusTypeName.get();

public void setcustID(String value)
this.custID.set(value);


public void setFirstName(String value)
this.FirstName.set(value);


public void setLastName(String value)
this.LastName.set(value);


public void setOrganization(String value)
this.Organization.set(value);


public void setPhone(String value)
this.Phone.set(value);


public void setEmail(String value)
this.Email.set(value);


public void setCusTypeID(String value) this.CusTypeID.set(value);

public void setCusTypeName(String value) this.CusTypeName.set(value);

public StringProperty custIDProperty()
return this.custID;


public StringProperty FirstNameProperty()
return this.FirstName;


public StringProperty LastNameProperty()
return this.LastName;


public StringProperty FirstOrganizationProperty()
return this.Organization;


public StringProperty PhoneProperty()
return this.Phone;


public StringProperty EmailProperty()
return this.Email;


public StringProperty CusTypeID() return this.CusTypeID;

public StringProperty CusTypeName() return this.CusTypeName;





This question already has an answer here:



  • What is a NullPointerException, and how do I fix it?

    12 answers



  • What is a stack trace, and how can I use it to debug my application errors?

    7 answers







java sql javafx filter scenebuilder






share|improve this question









New contributor




a p is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




a p is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 16 hours ago









fabian

48.4k114868




48.4k114868






New contributor




a p is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 18 hours ago









a p

83




83




New contributor




a p is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





a p is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






a p is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




marked as duplicate by fabian java
Users with the  java badge can single-handedly close java questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
16 hours ago


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by fabian java
Users with the  java badge can single-handedly close java questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
16 hours ago


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.













  • data seems to be null.
    – fabian
    16 hours ago
















  • data seems to be null.
    – fabian
    16 hours ago















data seems to be null.
– fabian
16 hours ago




data seems to be null.
– fabian
16 hours ago

















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3