So right now I am trying to program something like paint with greenfoot. I try to use the methods from the Api GreenfootImage. Now i got a problem which i don´t really understand
now ".drawPolygon" is showing an Error "non-static method drawPolygon(...) cannot be refernded from a static context.
Anyone who can help me fix it?
import greenfoot.*;
import java.lang.Object;
import greenfoot.GreenfootImage;
import java.util.Scanner;
import java.*;
/**
* Write a description of class Freihandzeichnen here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Stift
{ int[] intXAchse = new int[100];
int[] intYAchse = new int[100];
/**
* Constructor for objects of class Freihandzeichnen
*/
public Stift()
{
{
}
}
public void Rechteck()
{
Scanner input = new Scanner(System.in);
System.out.print("Nenne die Länge für X:");
int XAchse = input.nextInt();
intXAchse[0] = XAchse;
System.out.print("Nenne die Länge für Y:");
int YAchse = input.nextInt();
intYAchse[0] = YAchse;
System.out.print("Nenne die Anzahl an Ecken:");
int pR = input.nextInt();
GreenfootImage.drawPolygon(intXAchse,intYAchse,pR);
}
}
