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

2013/11/10

font and size change...

payner2013 payner2013

2013/11/10

#
how can i change the font and font size?
public Label()     
{    
   GreenfootImage img = new GreenfootImage (600, 400);    
   img.setColor(java.awt.Color.white);  
   img.drawString("hello", 60, 100);    
   setImage(img);    
}    
SPower SPower

2013/11/10

#
img.setFont(someFont);
img.drawString(bla..);
bourne bourne

2013/11/10

#
img.setFont(new java.awt.Font("Helvetica", Font.PLAIN, 12));
// Draw text here
payner2013 payner2013

2013/11/10

#
it says there is a problem with the font @boourne
payner2013 payner2013

2013/11/10

#
@bourne
bourne bourne

2013/11/10

#
sorry, you need java.awt.Font.PLAIN as well if you aren't using an import
danpost danpost

2013/11/10

#
Change 'Font.PLAIN' to 'java.awt.Font.PLAIN'.
payner2013 payner2013

2013/11/10

#
Thank you :);
payner2013 payner2013

2013/11/10

#
and it's ok:)
You need to login to post a reply.