• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to close first form and set form values in 2nd form's text field  RSS feed

 
Azeem Rathore
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi my first language is German so bear with my English i am new to programming so kindly help me
I have login form which has 4 textfields username ,password, unit code ,unit code name after writing user name and password when i focus on unit code textfield another form pop up i have used Jlist and populate it with unit codes values from database and i have select button at the button of list it works fine according to my requirement
next step is when select unitcode in jlist and hit the select button it select the jlist value and fetch the unit name from database table and it should close the jlist pop up form and go back to login form and set the 4th textfield from unit name which retrieves from the previous form i hope i make you understand the code for the button is

one logic is this.close(); but it how to set value in unit name textfield in login form?
i cant use new login().setVisible(true); it create new form and i want to go back to my previous form
 
Khuzema Dharwala
Ranch Hand
Posts: 61
Java Linux Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How you created another form for your unit code textfield ?
 
Azeem Rathore
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the login form i have 4text field username password unit code when focus on unit table jlist form open just like pop up window the purpose for this jlisf form is to select unit code number so that when user select unit code 4th field populates automatic with unit name hope it makes sense
 
Azeem Rathore
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the login form i have 4text field username password unit code when focus on unit code textfield jlist form open just like pop up window the purpose for this jlist form is to select unit code number then query runs fetch unitcode name from where unit code match and then jlist form close and redirect to login form and set value of unit code in unit code text field and unit name in unitname textfield
Just tell me how to go back to previous form(login)
 
Khuzema Dharwala
Ranch Hand
Posts: 61
Java Linux Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can't you get the reference of your original login form object inside your jButton1ActionPerformed method code ? If you get that you can easily call setVisible(true) on that object after calling this.setVisible(false) inside jButton1ActionPerformed method.
 
Azeem Rathore
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes i can use reference of login but it open new login form and username and password field become empty user has to enter username and password again.
In the login form if i enter username and password then focus on third field jlist form open
If i use reference like
Login log= new login();
Login.setvisible(true);
Then it open new login form but i want to go back to previous login form where username and password already set in the text field
 
Khuzema Dharwala
Ranch Hand
Posts: 61
Java Linux Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to see your login form and jlist form code, can you paste them here ?
 
Azeem Rathore
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is the login code and also view the pic of login gui you will have idea what i m doing



here is the jlist window code
login.jpg
[Thumbnail for login.jpg]
Login form
Unitcode .jpg
[Thumbnail for Unitcode .jpg]
windows form login
 
Azeem Rathore
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
by the way usercredentials() function used in the login function isnot completed yet i have not added validation for unit code and unit name
 
Khuzema Dharwala
Ranch Hand
Posts: 61
Java Linux Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Azeem, I would suggest some modifications in your code.

In unitPop class




Then inside the unitcode1MouseClicked method




And finally inside jButton1ActionPerformed method

 
Azeem Rathore
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks alot brother it is solved now you saved meeeeeeeeeeeee
many many thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!