[英]How to verify the user input in a textfield to compare it with a variable?
我想驗證textfield
中的用戶輸入(數字)是否大於9
。 請注意,數字從1
到9
。 如果它大於9
我想向jOptionPane
顯示一些我已經講過的代碼:
else
if(jTextField1.contains()){ // want to compare it if it's bigger than 9 or not
jOptionPane1.showMessageDialog(this,"Please enter the number of the tab"); // wich means from 1 to 9
}
那么如何用Java做到這一點呢? 提前致謝 :)
您可以直接在jQuery的幫助下使用jQuery做到這一點,只需將id賦予我們的文本字段並使用以下代碼添加腳本標簽即可:
num = $("#yourId").val();
if(num>9){
alert("your message");
}
或您想要實現的任何其他目的
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.