繁体   English   中英

如何检查GUI中的文本字段是否包含某些内容?

[英]How do you check if a text field in a GUI contains something?

我正在尝试检查用户在文本字段中的输入是否包含某些字母,如果有的话,让它增加一个计数器。

//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"))
}   
if (tfYourName.getText().toUpperCase().contains("T"))
    counter++;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM