Solved

swing login application

Posted on 2002-06-24
4
196 Views
Last Modified: 2012-05-04
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
Comment
Question by:stanleyhuen
  • 2
4 Comments
 
LVL 92

Expert Comment

by:objects
Comment Utility
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
 
LVL 9

Accepted Solution

by:
Venci75 earned 200 total points
Comment Utility
... 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
 
LVL 92

Expert Comment

by:objects
Comment Utility
> ... 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
 
LVL 3

Expert Comment

by:randyd
Comment Utility
it's different because it is a concrete example :)

randy
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now