• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using user inputs in other class  RSS feed

 
Taylan Altay Senturk
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

I have a LoginScreen class and one other class in my project. I want use user inputs (Username And Password) on other class if users details is true. I am stcuk at this point because when user attempt to Login connection is succesfully and other frame is coming to screen but i can reach user details anymore. Let me explain with codes;

LoginScreen class





MainProgramWindow class



You can see Button Action in MainProgramWindow " System.out.println( ??? );" How i can retrieve users inputs from this class ?

Thanks
 
Campbell Ritchie
Marshal
Posts: 56587
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I have had to break the lines because the code which NetBeans produces automatically goes off the margins of the screen.

you should not pass anything like that to a GUI class. You should have a class which manages logins, and retrieve the data from a GUI class to the login manager class. You should have only one JFrame or class extending it, and object instantiated from it for one application. If you need a second object to manage input, it is probably best to use an object of one of the dialogue classes.
 
Taylan Altay Senturk
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry fort the long lines. I solve this problem.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!