我怎样才能从密码字段中获取文本? [英] How Can I Grab Text From Passwordfield?
本文介绍了我怎样才能从密码字段中获取文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
char password = userPass.getPassword();
String Box2 = Character.toString(password);
这个方法给我一个错误?
告诉我一个正确的方法从密码字段转换字符并将其转换为字符串?
this method gives me an error?
tell me a correct way to convert char from passwordfield and convert it to string?
推荐答案
尝试使用此代码:
Try with this code:
String passText = new String(userPass.getPassword());
试试这段代码:
Try this code:
char[] password = userPass.getPassword();
String passwordString = new String(password);
这篇关于我怎样才能从密码字段中获取文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文