jpasswordfield - Java Program That Reveals Hidden Password -
i want make simple java program reveals password copied browser or application hidden in form of asterisks.
i wrote code doesn't work!
when copy password facebook password field example, , paste jpasswordfield on program. , transform normal text, shows me wrong output (in fact, gives me class name weird)
however, when copy normal text , paste jpasswordfield , text, gives correct normal text back!
so why isn't working? i'm sorry if question seems stupid little. i'm new programming , practical programs. how can make work? :d
thanks in advance, here's code:
class passwordviewer extends jframe { jpasswordfield field = new jpasswordfield(20); jbutton btn = new jbutton("ok"); jpanel panel = new jpanel(); char[] s; passwordviewer() { setsize(300, 300); panel.add(field); panel.add(btn); setdefaultcloseoperation(exit_on_close); add(panel); btn.addactionlistener(new actionlistener() { public void actionperformed(actionevent arg0) { s = field.getpassword(); findpass(); } }); } void findpass() { string str = ""; (int = 0; < s.length; i++) { str += s[i]; } joptionpane.showmessagedialog(null, str, "passwordviewer", joptionpane.information_message); } public static void main(string[] args) { passwordviewer passview = new passwordviewer(); passview.setvisible(true); } }
apparently, cannot copy browser's password field @ankitkatiyar91 pointed out. mistaken. question meaningless until can find way copy password browser's password field.
Comments
Post a Comment