This section illustrates you how to create a Login form.
To create a Login Form, we have used two class files:
In the LoginDemo.java, we have create two text fields text1 and text2 to set the text for username and password. A button is created to perform an action. The method text1.getText() get the text of username and the method text2.getText() get the text of password which the user enters. Then we have create a condition that if the value of text1 and text2 is roseindia, the user will enter into the next page on clicking the submit button. The NextPage.java is created to move the user to the next page. In case if the user enters the invalid username and password , the class JOptionPane provides the MessageDialog to shows the error message.
Here is the code of NextPage.java
Here is the code of LoginDemo.java
Output will be displayed as:
Ask your questions, our development team will try to give answers to your questions.