如何检查 JTextField 文本到字符串?
我在检查文本和字符串时遇到问题。
public boolean Isequals(Object c){
boolean check = false;
if (c instanceof MyTextTwist){
MyTextTwist tt = (MyTextTwist)c;
if (txtGuessPad.getText().equals(answer))
check = true;}
return check;
}
这是我到目前为止所拥有的。
I have a problem on checking the text and string.
public boolean Isequals(Object c){
boolean check = false;
if (c instanceof MyTextTwist){
MyTextTwist tt = (MyTextTwist)c;
if (txtGuessPad.getText().equals(answer))
check = true;}
return check;
}
this what i have so far.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于您的问题不是很清楚,我建议这些答案:
第一个选项 - 您想从 JTextField 获取字符串:
第二个选项 - 您想检查文本是否仅包含字母:
第三个选项 - 您想比较两个字符串(其中之一)它们来自 JTextField):
第四个选项 - 让我们把它放在一个函数中:
Since your question is not very clear, i suggest these answers:
1st option - you want to get string from your JTextField:
2nd option - you want to check if text contains only letter:
3rd option - you want to compare two strings (one of them is from JTextField):
4th option - let's put it in a function: