Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Swing / AWT / SWT and the fly likes My second frame will not open and my first will not close Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "My second frame will not open and my first will not close" Watch "My second frame will not open and my first will not close" New topic
Author

My second frame will not open and my first will not close

Isaac Skelton
Greenhorn

Joined: Sep 06, 2012
Posts: 5

Im having problems with the secong frame, I have put in capital letters a comment next to my problem. I can not get the old frame to disapear and open the new one (I dont know if login.dispose() is even java, it was just a guess).


Thanks in advanced I. Skelton
Greg Brannon
Bartender

Joined: Oct 24, 2010
Posts: 561
Use the equals() method to compare Strings.

if username.equals( "this" )

etc. . .


Always learning Java, currently using Eclipse on Fedora.
Linux user#: 501795
Isaac Skelton
Greenhorn

Joined: Sep 06, 2012
Posts: 5

Greg Brannon wrote:Use the equals() method to compare Strings.

if username.equals( "this" )

etc. . .


Thanks you so much, it worked perfect and it was a quick reply to my question.
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

What is that empty statement in else doing there?

When comparing strings, make sure you use equals() as suggested, and try to do it this way:
This way you avoid getting a NullPointerException.

Also, try not to name your variables like_this, but likeThis, since it's common in Java.


The quieter you are, the more you are able to hear.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: My second frame will not open and my first will not close