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

package lt.monarch.swing;

import java.awt.*;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseEvent;
import javax.swing.*;
import lt.monarch.chart.Chart;
import lt.monarch.chart.ChartContainer;

public class JChartPanel extends JPanel
    implements ChartContainer
{

    private void updateChartSize()
    {
        Insets insets = getInsets();
        Dimension dimension = getSize();
        chart.setContainer(this, new Rectangle(insets.left, insets.top, dimension.width - insets.right - insets.left, dimension.height - insets.bottom - insets.top));
    }

    public Component getComponent()
    {
        return (Component)this;
    }

    public String getToolTipText(MouseEvent mouseevent)
    {
        return chart.tipAt(mouseevent.getPoint());
    }

    public void paintComponent(Graphics g)
    {
        super.paintComponent(g);
        chart.paint(g);
    }

    public void addNotify()
    {
        super.addNotify();
        ToolTipManager.sharedInstance().registerComponent(this);
    }

    public void removeNotify()
    {
        super.removeNotify();
        ToolTipManager.sharedInstance().unregisterComponent(this);
    }

    public JChartPanel(Chart chart1)
    {
        setBackground(Color.white);
        chart = chart1;
        updateChartSize();
        addComponentListener(new _cls1());
    }

    protected Chart chart;


    private class _cls1 extends ComponentAdapter
    {

        public void componentResized(ComponentEvent componentevent)
        {
            updateChartSize();
        }

        public void constructor$0(JChartPanel jchartpanel)
        {
        }

        public _cls1()
        {
            constructor$0(JChartPanel.this);
        }
    }

}
