0% found this document useful (0 votes)
185 views

Advanced Java Practical 12

The document provides examples of Java programs using Swing components like JPasswordField and JTextField. It includes 3 programming exercises: 1) Using JPasswordField to display passwords as # instead of *, 2) Using JPasswordField and JTextField for user authentication, and 3) Using JPasswordField to validate the password length is greater than 6 characters and display an error message if it is not. Source code and output is provided for each example.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
185 views

Advanced Java Practical 12

The document provides examples of Java programs using Swing components like JPasswordField and JTextField. It includes 3 programming exercises: 1) Using JPasswordField to display passwords as # instead of *, 2) Using JPasswordField and JTextField for user authentication, and 3) Using JPasswordField to validate the password length is greater than 6 characters and display an error message if it is not. Source code and output is provided for each example.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Program Code

Q1. Write a program using JPasswordField to set the password character as ‘#’ instead of ‘*’
Source Code:

Output:
Exercise

Q1. Write a program using JPasswordField and JTextField to demonstrate the use of user
authentication

Source Code:
Output:
Q2. Write a program using JTextField to perform the addition of two numbers

Source Code-
Output:
Q3. Write a program using JPasswordField to accept password from user and if the length is less
than characters then error message should be displayed “Password length must be >6
characters”

Source Code:
Output:

You might also like