验证jDateChooser [英] validating a jDateChooser
本文介绍了验证jDateChooser的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的Java应用程序中有一个jFrame,它将选定的日期插入数据库中.我想验证字段是否为空.
I have a jFrame in my java application which inserts the selected date into the database. I want to validate if field is empty.
代码如下:
if(!this.jtxtDate.getSelectedItem.toString().isEmpty()) {
idc.setDate(this.jtxtDate.getDate);
} else {
JOptionPane.showMessageDialog(rootPane, "pls choose date");
}
推荐答案
dateChooser.setEnabled(false);
dateChooser.setEnabled(false);
dateChooser.getCalendarButton().setEnabled(true);
dateChooser.getCalendarButton().setEnabled(true);
因此,您无法编辑集成到JDateChooser的文本字段.
So you can't edit the textfield integrated to the JDateChooser.
这篇关于验证jDateChooser的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文