am i missing some thing?
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class poi here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class poi extends Actor
{
public final String LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
public final String letters = "abcdefghijklmnopqrstuvwxyz";
public final String Numbers = "0123456789";
public final String Symbols = "`~!@#$%^&*()_+-=[]{}|;':<>?,./";
public String txtString = "";
public void act()
{
String myKey = Greenfoot.getKey();
if (myKey == null) { return; }
String myText = "";
if (myKey == "space") { myKey = " "; } // If spaces are not wanted, change 'myKey = " ";' to 'return;'
if (myKey == "backspace")
{
// Code for when 'backspace' is pressed
if (txtString.length() > 0)
{
txtString = txtString.substring(0, txtString.length() - 1);
}
return;
}
if (myKey == "enter")
{
// Code for when 'enter' is pressed
return;
}
// You can continue for other keys: arrow keys, function keys, 'tab' and 'escape' (and any others I may have missed)
// Change the concatenation in the following statement to only wanted characters
String goodChars = LETTERS + letters + Numbers + Symbols + " ";
int myIndex = goodChars.indexOf(myKey.charAt(0));
if (myIndex > -1)
{
myText = goodChars.substring(myIndex, myIndex + 1);
txtString = txtString + myText;
}
new GreenfootImage(70, 60);
// wrong method?
drawString(txtString, 60, 50);
setImage(txtString);
}
}


