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

2015/2/7

IOException writing debug log

xWanna xWanna

2015/2/7

#
Hey, my problem is that every time I try to create a new Label I get an error.
IOException writing debug log IOException writing debug log IOException writing debug log IOException writing debug log IOException writing debug log IOException writing debug log IOException writing debug log IOException writing debug log IOException writing debug log IOException writing debug log IOException writing debug log IOException writing debug log IOException writing debug log IOException writing debug log IOException writing debug log IOException writing debug log IOException writing debug log IOException writing debug log IOException writing debug log IOException writing debug log
This is my code for the Label
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Font;
import java.awt.Color;
/**
 * Write a description of class Lable here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Label extends Actor
{
    public Label(){
        super();
        GreenfootImage img = new GreenfootImage(200, 40);
        setImage(img);

    }

    public void setText()
    {
        GreenfootImage img = getImage();
        img.clear();
        img.drawString("Test", 4, 30);

    }
    public void setColor(Color c){
        GreenfootImage img = getImage();
        img.setColor(c);

        
    }

    public void setFontFace(String face){

        GreenfootImage img = getImage();
        Font oldFont = img.getFont();
        Font newFont = new Font(face, oldFont.getStyle(), oldFont.getSize());
        img.setFont(newFont);

    }

    public void setFontStyle(int style){

        GreenfootImage img = getImage();
        Font oldFont = img.getFont();
        Font newFont = new Font(oldFont.getFontName(), style, oldFont.getSize());
        img.setFont(newFont);

    }

    public void setFontSize(int size){

        GreenfootImage img = getImage();
        Font oldFont = img.getFont();
        Font newFont = new Font(oldFont.getFontName(), oldFont.getStyle(),size);
        img.setFont(newFont);

    }

    /**
     * Act - do whatever the Lable wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {
        // Add your action code here
    }


}
Hope you can help me
Super_Hippo Super_Hippo

2015/2/7

#
I sometimes get this error, too. Restarting Greenfoot usually helps.
xWanna xWanna

2015/2/7

#
Thanks man.
You need to login to post a reply.