// Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov  Date: 08/10/2012 8:47:52
// Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   LabelDelPastel.java

package project;

import java.awt.*;
import javax.swing.JComponent;
import javax.swing.JPanel;
import traduccion.Traducir;

// Referenced classes of package project:
//            AccederADatos

public class LabelDelPastel extends JPanel
{

    public LabelDelPastel(int z)
    {
        todas = 1;
        bien = 0;
        mal = 0;
        posIniX = 45;
        posIniY = 190;
        todas = z;
        setPreferredSize(new Dimension(200, 190));
        setOpaque(false);
    }

    public void paint(Graphics g)
    {
        Font f1 = new Font("Arial", 0, 9);
        g.setFont(f1);
        int pieChartyOffset = 50;
        int pieChartOffset = 60;
        int angleOffset = 90;
        Dimension dim = new Dimension(324, 240);
        int ySize = dim.height - pieChartOffset - 100;
        int xSize = dim.width - pieChartOffset * 2;
        g.setColor(Color.black);
        g.fillRect(posIniX + 199, posIniY - 184, 10, 10);
        g.setColor(Color.green);
        g.fillRect(posIniX + 200, posIniY - 183, 10, 10);
        g.setColor(Color.black);
        g.drawString(Traducir.getTraduccion(AccederADatos.leer("h.proyecto"), "project.LabelDelPastel", "200411181249", AccederADatos.idioma), posIniX + 212, posIniY - 175);
        g.setColor(Color.black);
        g.fillRect(posIniX + 199, posIniY - 169, 10, 10);
        g.setColor(Color.red);
        g.fillRect(posIniX + 200, posIniY - 168, 10, 10);
        g.setColor(Color.black);
        g.drawString(Traducir.getTraduccion(AccederADatos.leer("h.proyecto"), "project.LabelDelPastel", "200411181251", AccederADatos.idioma), posIniX + 212, posIniY - 160);
        Graphics2D g2 = (Graphics2D)g;
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        int redAngle = -((mal * 360) / todas);
        int greenAngle = -((bien * 360) / todas);
        for(int i = 0; i < 5; i++)
        {
            g.setColor(new Color(0, 0, 150 + i * 20));
            g.fillArc(pieChartOffset, (pieChartyOffset + 10) - i, xSize, ySize, 0, 360);
        }

        for(int i = 0; i < 10; i++)
        {
            g.setColor(new Color(200 + i * 5, 0, 0));
            g.fillArc(pieChartOffset, pieChartyOffset - i, xSize, ySize, angleOffset, redAngle);
            g.setColor(new Color(0, 200 + i * 5, 0));
            g.fillArc(pieChartOffset, pieChartyOffset - i, xSize, ySize, angleOffset + redAngle, greenAngle);
        }

    }

    public void aumentar(int ac2, int fa2)
    {
        bien = ac2;
        mal = fa2;
        repaint();
    }

    int todas;
    int bien;
    int mal;
    int posIniX;
    int posIniY;
}