# How to change the alpha of a JPanel?

**URL:** <https://forum.kirupa.com/t/how-to-change-the-alpha-of-a-jpanel/223350>\
**Category:** programming\
**Created:** [April 21, 2007, 4:39pm UTC](https://forum.kirupa.com/t/how-to-change-the-alpha-of-a-jpanel/223350 "2007-04-21T16:39:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nickcherryjiggz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/nickcherryjiggz/32/2107_2.png) [@nickcherryjiggz](https://forum.kirupa.com/u/nickcherryjiggz)\
**Post date:** [April 21, 2007, 4:39pm UTC](https://forum.kirupa.com/t/how-to-change-the-alpha-of-a-jpanel/223350/1 "2007-04-21T16:39:19Z")

</div>

I’m pretty new to Java, so sorry if this is a dumb question. I’m trying to make a JPanel semi-transparent. I have the class playPanel.java…

```auto

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

public class playPanel extends JPanel
{
    int blockType;
    public playPanel()
    {
        super();
        setLayout(null);
    }
}

```

…and from another class, gameFrame.java, I create a new playPanel…

```auto
pp = new playPanel();
pp.setBounds((int)(appWidth * .5 - playWidth * .5), (int)(appHeight * .5 - playHeight * .55 - 10), playWidth, playHeight);
getContentPane().add(pp);

```

Is there an easy way to change the alpha of pp?
