I have this font constructor written to make the font I want BOLD, however whenever I try to compile, it tells me the error Cannot find symbol - variable BOLD
.
Font font = new Font("Arial",font.BOLD, 40);
These are the classes I'm importing:
import greenfoot.*;
import java.util.*;
import greenfoot.Font;
import java.lang.Class;
If anyone knows the probably quick fix it'd be much appreciated.
You're using the constructor incorrectly. Per the documentation:
Constructor and Description
Font(java.lang.String name, boolean bold, boolean italic, int size)
Creates a font from the specified font name, size and style.
It should be like so (bold, non-italic):
Font font = new Font("Arial", true, false, 40);
You were using the constructor incorrectly and attempt to access an instance variable that did not exist.