I'm having trouble inserting a colors and fonts into my code even though I imported both java.awt.Color and java.awt.Font. It gives me errors in lines 15, 17,
and 19
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import greenfoot.*; import java.lang.Object; import java.awt.Color; import java.awt.Font; public class Score extends Actor { public Score(){ GreenfootImage newimage = new GreenfootImage( 100 , 50 ); setImage(newimage); } public void setScore( int score){ GreenfootImage newimage = getImage(); newimage.clear(); Font f = new Font( "Comis Sans MS" , Font.PLAIN, 32 ); newimage.setFont(f); Color c = new Color( 127 , 127 , 127 , 127 ); newimage.setColor(c); newimage.fill(); newimage.setColor(Color.RED); newimage.drawString( "" +score, 200 , 20 ); setImage(newimage); } } |