If 'getRandomLetter()' was your method name and you called it with 'String randomLetter = getRandomLetter();', then background.drawString(randomLetter, x, y);' would draw the letter at (x, y) in your background.
String alphaBet = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
method() {
int x = Greenfoot.getRandomNumber(this.getWidth());
int y = Greenfoot.getRandomNumber(this.getHeight());
Greenfoot.getRandomNumber(26) = int
int = String
background.drawString(String, x, y);
}
Just add an instance boolean variable to the class -- call it something like 'fillObject'.
private boolean fillObject = true;
Then, anytime the 'f' is pressed, change the value of 'fillObject'
if ("f".equals(lastKeyPressed)) fillObject = !fillObject;
lastKeyPressed should be set up as a String variable and loaded with a non-null keystroke acquired through Greenfoot.getKey().
Finally, when drawing your objects:
if (fillObject) objectName.fill();
would fill the object if fillObject was true and not fill the object when false ('objectName' would be whatever name you supplied for your object).