0
對於使用客戶端驗證和消息對話框彈出框爲空的文本框,您如何爲integer
和double
編碼?Java客戶端/服務器驗證:如果jtextfield爲空?
我實現了String empname
但是我似乎無法彈出一個對話框empid
和payrate
,任何建議將不勝感激。
String empname = jtfEname.getText();
//If no text is entered display pop up dialog box.
if(empname.length()==0)
JOptionPane.showMessageDialog(null, "Please Enter Your Name");
int empid = Integer.parseInt(jtfEid.getText().trim());
//If no id is entered display pop up dialog box.
if (empid.equals(""))
JOptionPane.showMessageDialog(null, "Please Enter Your Id");
double payrate = Double.parseDouble(jtfPayRate.getText().trim());
//If no payrate is entered display pop up dialog box
if (payrate.equals(""))
JOptionPane.showMessageDialog(null, "Please Enter Your Pay Rate");
現貨做得很好感謝您的意見,祝您有個美好的一天 – CaseyT 2014-09-01 09:16:50
@CaseyT沒問題。樂於幫助。 :) – lxcky 2014-09-01 09:18:07