In the following tutorial, you can know the basic rule of how to link the jframes together and how to pass the value of anything into another jframe. A jframe is a container which contains the features of any frame window such as minimize, moving and resize the window. Basically to design the frame window, we would define a sub class of the jframe first. There can be many methods to link the two or more than two jframes together and one of the method is given below. And to pass the value from one frame to another you need the Vpass inside the main class.
Steps to follow
To link the table and pass their value, firstly you need to make a new project in your netbeans and make 2 jframes one for your login and another for simple passing the value in the same package as shown in the file below. Then you need to make a simple login GUI by using username and password as label and text field and password field respectively. You also need to add a button as submit. You need to make a label on the second jframe called dashboard as it helps to attach the value. In the project the value of username is passed to the next frame and shown in the next jframe. After that you need to follow the following steps in the source section.
- You need to make a certain username and password
- You need to check the username and password is equal to the given username and password
- If it is correct then you need to transfer into the next jframe
- Else you need to show error message
- If the username and password is correct then the value of the username should be passed into the new frame by using V pass.
The code for all steps above is given below in the figure.
The figure above show the code for the login screen and to check the validation
the figure above show the code used for the dashboard and using of v pass
You can download the Source Code for this project by clicking the download button below: