Questions tagged [jpasswordfield]

The Java Swing component for a single line of masked text input (typically a password).

113 questions
36
votes
5 answers

Why getText() in JPasswordField was deprecated?

I never thought before, only I used the method getPassword that returning an array of characters and I had seen the getText method was deprecated. But now that I think, why this method was deprecated?. The Java documentation explains: Deprecated.…
Paul Vargas
  • 41,222
  • 15
  • 102
  • 148
7
votes
1 answer

How do enable cut, copy in JPasswordField?

I noticed that i was unable to cut and copy in JPasswordField? Now how to copy/cut the selected part of the password to clipboard? Are there any methods to do this?
JavaTechnical
  • 8,846
  • 8
  • 61
  • 97
6
votes
2 answers

Rendering Java JPasswordField?

I am trying to find the method that actually renders the JPassword field. Maybe render is not the right word, so here is the deal: I am trying to make the JPassword field show a different number of characters instead of the same length as the actual…
MAK2020
  • 93
  • 7
6
votes
1 answer

JPasswordField security with action command

I am using a JPasswordField in my program. When I ask getPassword(), I get a char[] array. But when I add an ActionListener to the JPasswordField and ask getActionCommand(), I get the password as a String. Is this password save in the event object…
Yggdrasil
  • 1,377
  • 2
  • 13
  • 27
6
votes
5 answers

JPasswordField KeyPress string length error?

I am trying to change background colors of a JPasswordField in Java Swing (Netbeans). Here's what I have: private void pstxtPasswordKeyPressed(java.awt.event.KeyEvent evt) { //Get string from password…
jessechk
  • 450
  • 5
  • 15
5
votes
3 answers

What are the security reasons for JPasswordField.getPassword()?

Since Java 1.2, JPasswordField.getText() has been deprecated "for security reasons", ecouraging usage of getPassword() method "for stronger securty". However, I was able to get the password stored in JPasswordField at least in Oracle JRE 1.7 by…
Alex Abdugafarov
  • 6,112
  • 7
  • 35
  • 59
5
votes
4 answers

How can I give this password field focus?

This may seem trivial, but I can't figure out how to give the password box in this dialog focus. import javax.swing.JOptionPane; import javax.swing.JPasswordField; public class PasswordBox { @SuppressWarnings("unused") public String…
user623990
5
votes
3 answers

how to display characters in jPasswordField rather than * sign in java?

I am working with jPasswordField in java in order to make a log in system. I have used jTextField for name input and jPasswordField for password. I want to create an option of "Show Characters" in my program that may allow the user to view the…
5
votes
2 answers

JPasswordField encoding the input

Java's JPasswordField is encoding the input which user enter in password field and I don't want it. I am checking password against database values which are purely numeric values. Am entering the numeric values for password as 12345 and it…
4
votes
4 answers

getText() vs getPassword()

I'm currently designing a login system for a make-believe company, right now all I have is the Main login, which needs a lot of cleaning up. Below is my login handler. private class LoginButtonHandler implements ActionListener { public void…
Nathan Kreider
  • 516
  • 3
  • 7
  • 16
4
votes
1 answer

JPasswordField.getPassword() is still not secured?

Sorry to bring this topic up again, I have carefully read another similar question Why does JPasswordField.getPassword() create a String with the password in it? However I still think there is a loophole in JpasswordField implementation. I still…
HenryNguyen
  • 1,153
  • 1
  • 10
  • 8
4
votes
3 answers

validate a table's cell using editors

I have a Password field editor for my JTable. I want to display an error message if the text length is less than 8 bit when the user clicks to edit another field. I have tried focus listeners. But its not working. Please help me because i have just…
Nikhil
  • 2,857
  • 9
  • 34
  • 58
4
votes
2 answers

how to create a column cell for entering password in JTable

I'm creating a column in a JTable for passwords. I'm able to change the cell editor to password editor using the following code: JPasswordField pwf = new JPasswordField(); DefaultCellEditor editor = new DefaultCellEditor(pwf); …
merlachandra
  • 376
  • 2
  • 17
3
votes
2 answers

Replacing the password character to dot in JPasswordField

The default password symbol of a JPasswordField is a dot. But this will be replaced by Java Look and Feel to an asterisk. Is there a way that I can replace this symbol to the dot back again after loading the Look and Feel ? I already know that…
Roshana Pitigala
  • 8,437
  • 8
  • 49
  • 80
3
votes
1 answer

How to compare 2 passwords in java?

I'm working on a project with a registration form. The form asks the user to enter a password of their choice in a JPassword Field, and to enter it again in another JPassword Field. I'm using a JOptionPane to prompt the user if the passwords do not…
Aaronward
  • 129
  • 2
  • 11
1
2 3 4 5 6 7 8