I don't have any trouble in making the frames themselves. The issue that I am stuck on is how to differentiate between which frame to pull up.The program I am writing begins with a login frame and then based off what the user enters it pulls up the associated frame. For instance if the user is a student then after the login frame they would see the new student frame with the available options for them. Or if the user is an instructor than after they enter their credentials the new instructor frame pulls up with there options. Like I said above I can make the frames no problem I am just unsure how to differentiate between them after the login frame
Asked
Active
Viewed 225 times
0
-
How do you differentiate between different users? – MadProgrammer Apr 09 '15 at 22:20
-
1[The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/q/9554636/418556) - I would consider the use of a `CardLayout` instead, but that's me – MadProgrammer Apr 09 '15 at 22:50
1 Answers
0
From your explanation, you could keep your frames in a sort of Map. Frames will be assigned to values, frame names will be assigned to keys.
Then, you will be able to call :
map.get("student").show();
map.get("teacher").show();
Or, you could get loginType from the user names :
map.get(loginType(username)).show();
private abstract String loginType(String userName);
Ozgen
- 1,072
- 10
- 19