+ 6

Password Masking

How do you mask a password in an IDE?...a code example will be appreciated...

21st Jun 2019, 11:49 AM
Umar Idris
Umar Idris - avatar
6 Answers
+ 11
final String password, message = "Enter password"; if( System.console() == null ) { // inside IDE like Eclipse or NetBeans final JPasswordField pf = new JPasswordField(); password = JOptionPane.showConfirmDialog( null, pf, message, JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE ) == JOptionPane.OK_OPTION ? new String( pf.getPassword() ) : ""; } else password = new String( System.console().readPassword( "%s> ", message ) );
23rd Jun 2019, 2:39 AM
Assassin💞[#BeFierce]
Assassin💞[#BeFierce] - avatar
+ 11
Yes
23rd Jun 2019, 3:12 AM
Assassin💞[#BeFierce]
Assassin💞[#BeFierce] - avatar
+ 5
in case your are ever interested in android development its: given "password" is an EditText variable --> password.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
26th Jun 2019, 1:43 AM
Mind To Machine đŸ’»đŸ•†
Mind To Machine đŸ’»đŸ•† - avatar
+ 4
thank you dear,can you help me with the solution for the one without GUI...
23rd Jun 2019, 3:07 AM
Umar Idris
Umar Idris - avatar
+ 2
In an IDE? Not sure u can mask it.. Maybe on runtime, user might not see it that's when it can get mask but in an IDE? I doubt..
30th Jun 2019, 8:01 AM
Isaac Frank
Isaac Frank - avatar
+ 1
Mind To Machine đŸ’»đŸ•† you code Android apps?
18th Nov 2019, 10:08 AM
Detective_Khalifah
Detective_Khalifah - avatar