Application for Username and Password.
Q19. Design a Java NetBeans GUI application for checking Username and Password.
Sol:
Create a GUI application as per following screenshot.
Code For Log In
Type the following code by double clicking jButton1, button, below the line that says, ‘// TODO add your handling code here’
String user;
user=jTextField1.getText();
String pwd;
pwd=new String(jPasswordField1.getPassword());
if(user.equals(“CHB”) && pwd.equals(“root”))
JOptionPane.showMessageDialog(null,”Log In Successfull”);
else
JOptionPane.showMessageDialog(null,”Invalid Username or Password”);
}
Output: