package math.shapes;

import java.awt.*;
import javax.swing.*;

/**
 * zastosowanie klasy Arrow;
 */
public class ArrowPanel extends JPanel{
	private static final long serialVersionUID = 8983225865613648722L;

	public ArrowPanel(){
		setPreferredSize(new Dimension(500, 300));
		setBounds(0, 0, 500, 300);
		//setBackground(Color.BLUE);
	}

	@Override
	public void paintComponent(Graphics g) {
		super.paintComponent(g);
		Graphics2D g2 = (Graphics2D)g;
		g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
				RenderingHints.VALUE_ANTIALIAS_ON);
		Arrow ar = new Arrow(100f, 100f, 200f, 30f, 25f, 75f, 25f, false);
		g2.setColor(Color.RED);
		BasicStroke stroke = new BasicStroke(5);
		g2.setStroke(stroke);
		g2.fill(ar);
		g2.setColor(Color.BLACK);
		g2.draw(ar);
		Arrow ar1 = new Arrow(300f, 100f, 200f, 30f, 25f, 75f, 25f, true);
		g2.setColor(Color.MAGENTA);
		BasicStroke stroke1 = new BasicStroke(5);
		g2.setStroke(stroke1);
		g2.draw(ar1);
		g2.fill(ar1);
		Arrow ar2 = new Arrow(100f, 200f, 100f, 2f, 35f, 15f, 15f, true);
		g2.setColor(Color.BLUE);
		g2.fill(ar2);
		Arrow ar3 = new Arrow(250f, 150f, 100f, 2f, 235f, 50f, 5f, true);
		g2.setColor(Color.ORANGE);
		g2.fill(ar3);
		Arrow ar4 = new Arrow(450f, 150f, 200f, 10f, 190f, 45f, 15f, false);
		g2.setColor(Color.CYAN);
		BasicStroke stroke2 = new BasicStroke(5, BasicStroke.CAP_SQUARE,
				BasicStroke.JOIN_ROUND);
		g2.setStroke(stroke2);
		g2.draw(ar4);
		g2.fill(ar4);
	}
}
