Hi, i've tried everything but i can't seem to set a custom font with the solutions i've found recently. If i try the following code:Greenfoot won't let me compile the code because 'incompatible types: java.lang.String cannot be converted to boolean'. I find this very confusing because i don't get why it tries to convert to a boolean. Can anyone show an example where the font can be changed?
Here's the rest of the act() if necessary:
notification.setFont(new Font("Courier New", java.awt.Font.PLAIN, 12));
public void act() { World world = getWorld(); currentTime=System.currentTimeMillis(); if(currentTime>=timerBegin) { if(currentTime>=timer2Begin) { timer2Begin=timer2Begin+fadeSpeed; transparency=transparency-fadeStepsize; //this is a debugger, it does nothing else but display variables world.removeObjects(world.getObjects(Announcement.class)); world.addObject (new Announcement("custom announcement", "-Terminal window-\n"+transparency),500,500); if(transparency<=0) { transparency=0; world.removeObject(this); } } } else { if(currentTime>=timer2Begin) { //this is a debugger, it does nothing else but display variables world.removeObjects(world.getObjects(Announcement.class)); world.addObject (new Announcement("custom announcement", "-Terminal window-\n"+transparency),500,500); timer2Begin=timer2Begin+fadeSpeed; if(isTouching(Rocket.class)) { transparency=transparency-fadeStepsize; if(transparency<100) { transparency=100; } } else { transparency=transparency+fadeStepsize; if(transparency>255) { transparency=255; } } } } GreenfootImage notification = new GreenfootImage("notificationboard.gif"); notification.setTransparency(transparency); notification.setFont(new Font("Courier New", java.awt.Font.PLAIN, 12)); notification.drawString(text, 30,30); setImage(notification); }