Friday, 15 April 2011

java - Gui crashes after login code -



java - Gui crashes after login code -

this login code. code runs fine until gets part needs switch screens homepage. after displaying "you have logged in!" message ends program. ideas? using netbeans 7.3.1

private void jbutton1actionperformed(java.awt.event.actionevent evt) { boolean valid = false; string user = txtuser.gettext(); string pass = txtpass.gettext(); seek { scanner sc = new scanner(new file("file.txt")); while(sc.hasnextline()){ string[] line = sc.nextline().split("#"); if(line[0].equals(user) && line[1].equals(pass)){ valid = true; } } } grab (filenotfoundexception ex) {} if(valid == true){ joptionpane.showmessagedialog(null, "you logged in!"); system.out.println("you user!"); //doesn't run homepage adm = new homepage(); adm.setvisible(true); this.dispose(); }else{ joptionpane.showmessagedialog(null, "your username or password incorrect!"); }

check disposing in this.dispose(). perchance disposing jframe or other component contains rest of ui components

java login netbeans-7

No comments:

Post a Comment