This site requires JavaScript, please enable it in your browser!
Greenfoot back
Steven.Z.
Steven.Z. wrote ...

2015/1/5

how to change the font

Steven.Z. Steven.Z.

2015/1/5

#
hi i wanted to change the font but keep the style like i wanted; found some commands but then it didn't work the way i wanted
import java.awt.Color;
import java.awt.Font;

public void act() 
    {
      setImage(new GreenfootImage("Score: " + score, 24, Color.GREEN, Color.BLACK));
      img.setFont(new java.awt.Font("Avenir Black Oblique", java.awt.Font.PLAIN, 24));  
    }    
so as you see its the font of the score in my game but i want to keep the black background and the green color but use this font (its a normal one of ms office11) thanks
danpost danpost

2015/1/5

#
The method 'setFont' only changes the font used on subsequent drawing operations on the GreenfootImage object. It does not change any text that is already drawn on the image. I did create a TextImage Support Class that could be useful for what you want.
Steven.Z. Steven.Z.

2015/1/5

#
thanks
You need to login to post a reply.