Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Trying to get input text from JPasswordField

$
0
0
Hello everyone!

I am struggling with an annoying piece of code, for the login of my launcher.

I have create a JPasswordField, variable 'password' and I want to get the text the user has typed in.

I tried to do this, but it doesn't seem to get the value...

                login.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
		    	char[] passes = password.getPassword();
		    	String p = new String(passes);
		    	
		    	if(username.getText() == "test" && p.equals("test"))
		    	{
		    		JOptionPane.showMessageDialog(null, "Correct Details!");
		    	}
			} 
		});


Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>