|
|
|
#11 (permalink) | |||||||||||
|
Programmer
|
to me it looks like your logging into the app and want to validate the entered info then continue to the reset of the app?
Since your already logged in, the context of the app is based on the user, so you do not need any info from that login screen. Simple get a handle to the login window and dispose. Assuming the actionPerformed is part of the login window, you can do something like public void actionPerformed(ActionEvent evt) { Frame window = null; if (evt.getSource() == empLogin) { employeeLogin emp = new employeeLogin(); emp.init(); window = new Frame("Employee"); window.add("Center", emp); window.pack(); window.setVisible(false); } if (window != null) { //context based on login window this.dispose(); window.setVisible(true); } } of course you may have to play around, as i haven't done swing in a couple years. Web services ftw ![]() Keep us posted.
__________________
Relax and enjoy life!
|
|||||||||||
|
|
|
|
|
#12 (permalink) | |||||||||||||
|
New to Overclock.net
|
Code:
this.dispose(); But yes, Once the user types in the correct login/password then it will (in theory) close the login screen and open the logged on screen.
__________________
The GreenThing - You probably guessed it
![]()
|
|||||||||||||
|
|
|
|
|
#13 (permalink) | ||||||||||||
|
Programmer
|
Quote:
that is why you need the context of the login window. Once you have it you can dispose it from the windows manager and it's ready for garbage collection.
__________________
Relax and enjoy life!
|
||||||||||||
|
|
|
|
|
#14 (permalink) | ||||||||||||
|
New to Overclock.net
|
I am a bit rusty with AWT (why don't you use Swing, are you compiling using gcj or something) but you should be able to either create the new Frame and close the old one or get the content pane (whatever is the AWT equivalent) and replace its contents rather than creating a new window at all.
__________________
|
||||||||||||
|
|
|
|
|
#15 (permalink) | |||||||||||||
|
110100001101001111000
|
Quote:
Basically you'd just have Code:
JFrame mainFrame; JPanel login; JPanel loggedIn; // set up all your panels and frame properties mainFrame.setContentPane(login); mainFrame.pack(); //do stuff if(login is successful) mainFrame.setContentPane(loggedIn); mainFrame.pack()
__________________
Last edited by C-bro : 03-09-08 at 10:23 PM. |
|||||||||||||
|
|
|
|
#16 (permalink) | ||||||||||||
|
New to Overclock.net
|
Another advantage of Swing is that you can ditch the ye olde
__________________Code:
window.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
Code:
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||||||||
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|