// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3) fieldsfirst 
// Source File Name:   DrawingPanel.java

package lt.ktu.gmj.analysis;

import java.awt.*;
import java.util.Vector;
import javax.swing.JPanel;

// Referenced classes of package lt.ktu.gmj.analysis:
//			Plokste

class DrawingPanel extends JPanel
{

	int m_iLeft;
	int m_iTop;
	int m_iBottom;
	int m_iRight;
	Vector m_pPatterns;

	public DrawingPanel()
	{
		m_pPatterns = new Vector();
		m_iLeft = 0;
		m_iTop = 0;
		m_iBottom = 0;
		m_iRight = 0;
	}

	public void setValues(int i, int j, int k, int l, Vector vector)
	{
		m_iLeft = i;
		m_iTop = j;
		m_iBottom = k;
		m_iRight = l;
		m_pPatterns.removeAllElements();
		for(int i1 = 0; i1 < vector.size(); i1++)
			m_pPatterns.add(vector.elementAt(i1));

		repaint();
	}

	public void paintComponent(Graphics g)
	{
		super.paintComponent(g);
		Color color = g.getColor();
		g.setColor(Color.lightGray);
		for(int i = 0; i < getSize().height; i += 10)
			g.drawLine(0, i, getSize().width, i);

		for(int j = 0; j < getSize().width; j += 10)
			g.drawLine(j, 0, j, getSize().height);

		int l = getWidth();
		int i1 = getHeight();
		l = l / 2 - m_iRight / 2;
		i1 = i1 / 2 - m_iBottom / 2;
		g.setColor(Color.red);
		if(m_iRight > 0 && m_iBottom > 0)
			g.drawRect(l - 1, i1 - 1, m_iRight + 2, m_iBottom + 2);
		g.setColor(color);
		for(int k = 0; k < m_pPatterns.size(); k++)
		{
			Plokste plokste = (Plokste)m_pPatterns.elementAt(k);
			if(plokste.m_bUsed)
			{
				Color color1 = g.getColor();
				g.setColor(Color.darkGray);
				g.drawRect(l + plokste.nLeft, i1 + plokste.nTop, plokste.nWidth, plokste.nHeight);
				g.setColor(Color.lightGray);
				g.fillRect(l + plokste.nLeft + 1, i1 + plokste.nTop + 1, plokste.nWidth - 1, plokste.nHeight - 1);
				g.setColor(color1);
			}
		}

	}
}
