我试图做一个if和else语句,如果datetimepicker为空,它将不接受进程,所以我尝试了这个语句,但它只是忽略了它,所以任何可能的方法我如何从这个datetimepicker获取值或文本?
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
if(dateTimePicker1.equals("") || dateTimePicker2.equals("") || jTextField1.getText().equals("PACKAGES OFFERED: ")
|| jTextField5.getText().equals("FOOD SERVICES: ") || jTextField6.getText().equals("HOTEL ACTIVITIES: ")
|| jTextField7.getText().equals("HOTEL SERVICES: "))
{
jLabel8.setText("Invalid data please add valid data");
jLabel8.setOpaque(true);
}
else{
Hotel_Dashboard2 hd1 = new Hotel_Dashboard2();
Hotel_Dashboard2.jLabel8.setText(Hotel_Dashboard1.jLabel9.getText());
hd1.setVisible(true);
}
}
以下是我尝试的代码:
if(dateTimePicker1=='' || dateTimePicker2.==''
if(dateTimePicker1.length===(0) || dateTimePicker2.length===(0)
if(dateTimePicker1==null || dateTimePicker2.equals==null
暂无答案!
目前还没有任何答案,快来回答吧!