so i have been working on a project where there is a "login" button in a frame which i have created and i have to make it so that when the user clicks the "LOGIN" button the present window should terminate and a new window with labels and textfields would open prompting the user to enter his username, pass i have made the other frame with textfield n labels just dont know how to link the two together,i have made two different classes for both the LOGIN button frame and userid pass frame and these classes are called from a seperate main class which has main function in it please help gotta submit project on monday :( :(
Asked
Active
Viewed 427 times
1
-
3[The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/questions/9554636/the-use-of-multiple-jframes-good-bad-practice) – Reimeus Mar 23 '13 at 15:05
1 Answers
0
In Login
button: add action to it which allow you to
1- dispose the Login frame
2- open the second frame
Like this :
private void LoginButtonActionPerformed(java.awt.event.ActionEvent evt) {
dispose();////////////will dispose the Login frame
UsernameAndPassword username = new UsernameAndPassword();//////UsernameAndPassword :is the second frame.
username .setVisible(true);//////the Username and password frame will be visible
}

Alya'a Gamal
- 5,624
- 19
- 34