/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JPanel;

/**
 *
 * @author Haitham Gamal
 */
public class TransparentPanel extends JPanel {

    int blockType;

    private int red;
    private int green;
    private int blue;
    private int alpha;

    public TransparentPanel() {
        this(238, 238, 238, 100);
    }

    public TransparentPanel(int red, int green, int blue, int alpha) {
        super();
        setOpaque(false);
        setLayout(null);
    }

    @Override
    public void paintComponent(Graphics g)
    {
        super.paintComponent(g);
        //Color ppColor = new Color(g.getColor().getRed(), g.getColor().getGreen(), g.getColor().getBlue(), 90); //r,g,b,alpha
        Color ppColor = new Color(red, green, blue, alpha); //r,g,b,alpha
        g.setColor(ppColor);
        g.fillRect(0,0,this.getWidth(),this.getHeight()); //x,y,width,height
    }

    /**
     * @return the red
     */
    public int getRed() {
        return red;
    }

    /**
     * @param red the red to set
     */
    public void setRed(int red) {
        this.red = red;
    }

    /**
     * @return the green
     */
    public int getGreen() {
        return green;
    }

    /**
     * @param green the green to set
     */
    public void setGreen(int green) {
        this.green = green;
    }

    /**
     * @return the blue
     */
    public int getBlue() {
        return blue;
    }

    /**
     * @param blue the blue to set
     */
    public void setBlue(int blue) {
        this.blue = blue;
    }

    /**
     * @return the alpha
     */
    public int getAlpha() {
        return alpha;
    }

    /**
     * @param alpha the alpha to set
     */
    public void setAlpha(int alpha) {
        this.alpha = alpha;
    }
}
