I have tried 2 variations of this code:
to try to create a GreenfootImage object with a font inside it that has a Courier New font.
I have also tried this just to utilize the drawString() method:
Neither creates a text object. It's just a green foot. But the code compiles. :/ What am I doing wrong?
EDIT: OH! Also, if I add another parameter to the setFont:
It no longer compiles...?
public class Label extends Actor
{
String text = "blah, blah";
public void Label(String text)
{
// GreenfootImage image = new GreenfootImage(200, 200);
//image.drawString(text, 10, 16);
GreenfootImage image = new GreenfootImage(text, 14, Color.BLACK, Color.WHITE, Color.RED);
image.setFont(new Font("Courier New", 20));
setImage(image);
}
}public class Label extends Actor
{
String text = "blah, blah";
public void Label(String text)
{
GreenfootImage image = new GreenfootImage(200, 200);
image.drawString(text, 10, 16);
// GreenfootImage image = new GreenfootImage(text, 14, Color.BLACK, Color.WHITE, Color.RED);
image.setFont(new Font("Courier New", 20));
setImage(image);
}
} image.setFont(new Font("Courier New", Font.BOLD, 20));

