我试图检查用户在文本字段中的输入是否包含某些字母,如果有,则让它增加一个计数器。
//this is the code for the button
//tfYourName is the name of the text field
//below is what I've tried already
private void btnResultsMouseClicked(java.awt.event.MouseEvent evt) {
if (tfYourName.getSelectedItems.toString.toUpperCase().contains("T"))
}
答案 0 :(得分:0)
if (tfYourName.getText().toUpperCase().contains("T"))
counter++;