JOptionPane.InputDialog Validation

My Question is I want to show frame on validation. If User enter correct name in Input Dialog and Press ok so then it should show frame otherwise it should exit or ask again username.

Here is my code snippet

String inputValue = JOptionPane.showInputDialog("Please Enter UserName");

if(inputValue=="admin")

{

setVisible(true);

}

else{

System.exit(0);

}

What i am missing because using above code when i enter any name dialog disappear and also i am not getting any Frame.Help will be really appreciated.

[823 byte] By [haroon2006a] at [2007-10-2 14:48:09]
# 1
just a quick guess, try this, though like i say its only a guessframename.setVisible(true);
javakicksassa at 2007-7-13 13:23:36 > top of Java-index,Security,Event Handling...
# 2

> just a quick guess, try this, though like i say its

> only a guess

>

> > framename.setVisible(true);

Sorry Can you tell me how to get Frame Name as my class has following outlook

public class ChatClient extends Frame implements IChatClient, ActionListener

haroon2006a at 2007-7-13 13:23:36 > top of Java-index,Security,Event Handling...
# 3

if the code you gave is inside the frame class("ChatClient") then just say

this.setVisible(true);

tht's enough...

if not if you are in a frame that is created from with in this frame

then say like this.

ChatClient cc = (ChatClient)this.getParent();

cc.setVisible(true);

...hope this helps

kishore_killera at 2007-7-13 13:23:36 > top of Java-index,Security,Event Handling...
# 4
I am still not getting out of this problem it stil goes into else clause
haroon2006a at 2007-7-13 13:23:36 > top of Java-index,Security,Event Handling...
# 5
> if(inputValue=="admin")Use the equals() method for String comparison.
ajneoa at 2007-7-13 13:23:36 > top of Java-index,Security,Event Handling...
# 6
> > if(inputValue=="admin")> > Use the equals() method for String comparison.You know what You saved my life....That worked and my ChatRoom is working Perfectly..Thanx a million
haroon2006a at 2007-7-13 13:23:36 > top of Java-index,Security,Event Handling...