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?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 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); } } |