font.substringWidth() to find the length of a string in pixels
I want to find the length of a string in pixels.
System.out.println(font.substringWidth(s, 0, 10)); (font with a small f)
brings up the message "Cannot find symbol symbol variable font"
System.out.println(Font.substringWidth(s, 0, 10)); (Font with a capital F)
brings up the message "non-static method... cannot be referenced from a static context"
Can someone please show me how to do this?