1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- /*
- * 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.BasicStroke;
- import java.awt.Color;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import javax.swing.JPanel;
-
- /**
- *
- * @author Jan
- */
- public class FlaecheWeg extends JPanel
- {
- int[] randomwertex;
- int[] randomwertey;
- private BasicStroke pinsel;
- Color colorWeg;
-
- public FlaecheWeg()
- {
- randomwertex = new int[4];
- randomwertey = new int[4];
- pinsel = new BasicStroke(6f);
- colorWeg = new Color(190, 190, 190);
- }
-
- public void paintComponent(Graphics g)
- {
- super.paintComponent(g);
-
- Graphics2D g2 = (Graphics2D) g;
- g2.setColor(colorWeg);
- g2.setStroke(pinsel);
- for (int i = 0; i < randomwertex.length; i++)
- {
- g2.drawLine(randomwertex[i], randomwertey[0], randomwertex[i], randomwertey[3]);
- g2.drawLine(randomwertex[0], randomwertey[i], randomwertex[3], randomwertey[i]);
- }
- }
-
- public void setWeg(int[] x, int[] y)
- {
- randomwertex = x;
- randomwertey = y;
- repaint();
- }
- }
|