Simple jTextField Question

Hi,

I've a really simple bit of code and cannot figure out why it won't work.

All I basically want this to do is take the text entered into the jTextField, if it matches a certain word, a response to be printed in the jLabel,

(for instance here if someone enters 'hello', it to return 'welcome').

For some reason that I can't work out, all it responds with is the else statement. All I am thinking is its something to do with using a String in a boolean statement, but I'm quite confused.

privatevoid jButton1MouseClicked(java.awt.event.MouseEvent evt){

value = jTextField1.getText();

if (value=="hello"){

jLabel1.setText("welcome");

}

else

{

jLabel1.setText("Please enter a valid word");

}

Thanks

[1140 byte] By [Hysteria_86a] at [2007-11-27 11:14:04]
# 1

No worries, solved it, had to use value.equals as opposed to value ==

Hysteria_86a at 2007-7-29 14:04:49 > top of Java-index,Java Essentials,New To Java...
# 2

Good for you! Now that bug'll never bite you again (hopefully).

petes1234a at 2007-7-29 14:04:49 > top of Java-index,Java Essentials,New To Java...