/*
  This software is the confidential and proprietary information of
  Smardec. You shall not disclose or distribute such Confidential Information.
  This software shall not be integrated, copied (partially or fully),
  or reverse engineered into any other software, program, or code that is
  not intended for Smardec. You shall use it only in accordance with the terms
  of the license agreement you entered into with Smardec.

  Copyright (C) 2003-2006 Smardec. All rights reserved.

  http://www.smardec.com

*/

package com.smardec.demo.asc.outlookpanel.renderers.metalwood;

import com.smardec.asc.outlookpanel.OutlookTabBodyRenderer;

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

/**
 * Sample class that demonstrates the usage of <code>JOutlookPanel</code>.
 */
public class MetalWoodOutlookTabBodyRenderer extends JPanel implements OutlookTabBodyRenderer {
    private static final ImageIcon imageIconBG = new ImageIcon(MetalWoodOutlookTabHeaderRenderer.class.getClassLoader().getResource("com/smardec/demo/asc/img/outlookpanel/renderers/MetalWoodOutlookRenderer/TabBodyBG.gif"));
    private JPanel jPanelBody;

    public Component getOutlookTabBodyRendererComponent(JPanel jPanelBody) {
        this.jPanelBody = jPanelBody;
        setSize(jPanelBody.getSize());
        return this;
    }

    public void paint(Graphics g) {
        int width = imageIconBG.getImage().getWidth(null);
        int height = imageIconBG.getImage().getHeight(null);
        for (int i = 0; i <= jPanelBody.getWidth(); i += (width))
            for (int j = 0; j <= jPanelBody.getHeight(); j += (height))
                g.drawImage(imageIconBG.getImage(), i, j, width, height, this);
    }
}
