Zdar, vyskytl se další problém. Proč mi nefunguje metoda MakeRectangel?
zdroják
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.Shape;
import javax.swing.JComponent;
public class gameGraphics extends JComponent{
private Rectangle[] rectPole = new Rectangle[5];
private Graphics g;
private Graphics2D g2d = (Graphics2D)g;
private int index=0;
public void paint (Graphics g) {
}
public void MakeRectangle(int x, int y, int vyska, int sirka){
rectPole[index] = new Rectangle(x, y, sirka, vyska);
g2d.fill( rectPole[index]);
index++;
}
}