Hey,
my problem is that every time I try to create a new Label I get an error.
Hope you can help me
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
}
}
