# G4P Gpanel and Gview

**URL:** https://discourse.processing.org/t/g4p-gpanel-and-gview/25474
**Category:** Libraries
**Created:** [November 16, 2020, 9:53pm UTC](https://discourse.processing.org/t/g4p-gpanel-and-gview/25474 "2020-11-16T21:53:30Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Piko](https://avatars.discourse-cdn.com/v4/letter/p/71c47a/32.png) [@Piko](https://discourse.processing.org/u/Piko)
#### Post date: [November 16, 2020, 9:53pm UTC](https://discourse.processing.org/t/g4p-gpanel-and-gview/25474/1 "2020-11-16T21:53:30Z")

</div>

Hi,

I want to add a GView area on a Gpanel but when i do this the color of the Gpanelcolors is darker. It looks like a shade on the view area. I would like to have this transparent to match the real backgroundcolor of the Gpanel.

Suggestions?

Code:

import g4p\_controls.\*;

GView view2D;  
GPanel pnMain;

void setup() {  
size(1280, 800, JAVA2D);  
background(#FFFFFF);  
textSize(15);

pnMain = new GPanel(this, 1, 1,1200,800, “Main Panel”);  
pnMain.setText(“Main Panel”);

view2D = new GView(this, 0,0, 900, 600, JAVA2D);  
pnMain.addControl(view2D);  
}

void draw(){}

---

<div class="post-metadata">

### Author: ![MiguelSanches](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/miguelsanches/32/11172_2.png) [@MiguelSanches](https://discourse.processing.org/u/MiguelSanches)
#### Post date: [November 17, 2020, 8:46am UTC](https://discourse.processing.org/t/g4p-gpanel-and-gview/25474/2 "2020-11-17T08:46:41Z")

</div>

Hi @Piko,

Welcome to the community! 🙂

I was looking at the documentation:

> **[G4P (GUI for Processing): g4p\_controls.GView Class Reference](http://www.lagers.org.uk/g4p/ref/classg4p__controls_1_1_g_view.html#ab81c220fbf0b8c426a30db9032073b98)**

and Processing also has an example of the GP4 library on how to use GView.  
So, the following code does what you ask

```auto
import g4p_controls.*;

GView view2D;
GPanel pnMain;

void setup() {
size(1280, 800, JAVA2D);
background(#FFFFFF);
textSize(15);

pnMain = new GPanel(this, 1, 1,1200,800, "Main Panel");
pnMain.setText("Main Panel");

view2D = new GView(this, 0,0, 900, 600, JAVA2D);
pnMain.addControl(view2D);
}

void draw(){
  PGraphics v = view2D.getGraphics();
  v.beginDraw();
  v.background(0,255); // Change this line to (0,0) to make it transparent
  v.noStroke();
  v.endDraw();
}

```

But I was wondering if there is a simple way to do this. The documentation on the link shows that the GView inherits from other members.  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/9/941c4080dc3aa5bbb150afc6ccefb2dd39a13968.png)

Maybe @quark can help with this.  
Best regards

---

<div class="post-metadata">

### Author: ![Piko](https://avatars.discourse-cdn.com/v4/letter/p/71c47a/32.png) [@Piko](https://discourse.processing.org/u/Piko)
#### Post date: [November 17, 2020, 10:50am UTC](https://discourse.processing.org/t/g4p-gpanel-and-gview/25474/3 "2020-11-17T10:50:55Z")

</div>

Hi Migual,

Thanks!  
It did the trick.

Best regards
