I want to make the user able to search if he enters values for at least one of the fields given above. I captured the date selected from the JDateChooser
as given below.
String s = ((JTextField)searchOrderDateDateChooser.getDateEditor().getUiComponent()).getText();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");//set the date format
String datex = sdf.format(searchOrderDateDateChooser.getDate());
`
But this gives a NullPointerException
if a date is not selected. How can I overcome this and make the user able to enter either one of the fields and search.