I have a jFrame in my java application which inserts the selected date into the database. I want to validate if field is empty.
The code is like this:
if(!this.jtxtDate.getSelectedItem.toString().isEmpty()) {
idc.setDate(this.jtxtDate.getDate);
} else {
JOptionPane.showMessageDialog(rootPane, "pls choose date");
}
You could just check if you can get date from jDateChooser.
dateChooser.setEnabled(false);
dateChooser.getCalendarButton().setEnabled(true);
So you can't edit the textfield integrated to the JDateChooser.
Use this code inside try block: