12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package garten.view;
-
- import java.awt.Color;
- import java.awt.Graphics;
- import javax.swing.JPanel;
-
- /**
- *
- * @author Jan
- */
- public class FlaecheBeet extends JPanel
- {
- int[] randomwertex;
- int[] randomwertey;
-
- Color colorBeet;
-
- public FlaecheBeet()
- {
- randomwertex = new int[4];
- randomwertey = new int[4];
- colorBeet = new Color(153, 102, 51);
- }
-
- public void paintComponent(Graphics g)
- {
- super.paintComponent(g);
- g.setColor(colorBeet);
-
- for (int i = 0; i < randomwertex.length - 1; i++)
- {
- for (int j = 0; j < randomwertey.length - 1; j++)
- {
- g.fillRect(randomwertex[i] + 10, randomwertey[j] + 10, randomwertex[i + 1] - randomwertex[i] - 20, randomwertey[j + 1] - randomwertey[j] - 20);
- }
- }
- }
- public void setBeet(int[] x, int[] y)
- {
- randomwertex = x;
- randomwertey = y;
- repaint();
- }
- }
|