• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 212
  • Last Modified:

swing login application

I am writing a swing login application.
I have a screen have "username" and "password" fields,
after a user logined then he will go to a screen which he can change his password, but how can I bring the username from first screen to second screen?
0
stanleyhuen
Asked:
stanleyhuen
  • 2
1 Solution
 
objectsCommented:
You just need to store the userid somewhere that is accessible from the second screen.
Or store the userid and pass it to the second screen when you need to display it.
0
 
Venci75Commented:
... or store it in a static variable - then it will be global for the whole application:
public class MyClass {
public static String user = "user1";
.....
}

set it by using:
MyClass.user = "new_user";

and get it:
String user = MyClass.user;

0
 
objectsCommented:
> ... or store it in a static variable

How is that different than:

"You just need to store the userid somewhere that is accessible from the second screen"

:-)
0
 
randydCommented:
it's different because it is a concrete example :)

randy
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now