Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

swing login application

Posted on 2002-06-24
4
Medium Priority
?
210 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 92

Expert Comment

by:objects
ID: 7106471
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 800 total points
ID: 7106657
... 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
ID: 7106669
> ... 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
ID: 7111471
it's different because it is a concrete example :)

randy
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

636 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