This site requires JavaScript, please enable it in your browser!
Greenfoot back
Roshan123
Roshan123 wrote ...

2020/6/22

string

Roshan123 Roshan123

2020/6/22

#
what should i write in place of it
if(Greenfoot.isKeyDown("The quick brown")
{
    showText(Correct,150,100);
}
else showText(Wrong,150,100);
danpost danpost

2020/6/25

#
The String value of "The quick brown" is NOT the name of any keyboard button.
Roshan123 Roshan123

2020/6/25

#
so what should i write if anybody types THE QUICK BROWN it will show text according to the situation
danpost danpost

2020/6/25

#
Roshan123 wrote...
so what should i write if anybody types THE QUICK BROWN it will show text according to the situation
If you are to "capture" that somebody types a phrase (not just a single key or key-combination), you will have to collect each keystroke individually (over time). This will require a String field and extensive code to build the string (or control the field's value) as the keys are being entered. As an alternative, you could use:
if ("the quick brown".equals(Greenfoot.ask("Enter a string").toLowerCase())
You need to login to post a reply.