• Post Reply Bookmark Topic Watch Topic
  • New Topic

Object persistance  RSS feed

 
Tom Wheeler
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a login screen and when the user has filled out the login information I create a bean object like this:
User user = new User(getJTextField().getText(),
getJPasswordField().getText(),
getJTextField1().getText(),
getJTextField2().getText());
A soon as that is created I then need that info in another class to login into the database. How can I pass the object between classes? I've tried 'public', but that isn't right....how does the object need to be declared to persist between all classes? Or how can I get the values from my 'User' object from any class?
Thanks.
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tom,
In your bean class where you have this User object put a getter method like,
getUser() which returns the User object created when the user types in the information as you have done.
Thanks
Maulin
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!