# G4P Gtextbox border issue

**URL:** <https://discourse.processing.org/t/g4p-gtextbox-border-issue/25490>\
**Category:** Libraries\
**Created:** [November 17, 2020, 2:58pm UTC](https://discourse.processing.org/t/g4p-gtextbox-border-issue/25490 "2020-11-17T14:58:56Z")\
**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 17, 2020, 2:58pm UTC](https://discourse.processing.org/t/g4p-gtextbox-border-issue/25490/1 "2020-11-17T14:58:57Z")

</div>

Hi,

When i use a dark background and custom colorscheme on a GTextfield the bottom line of the textfield disappears. This behaviour is not with scrollbars.

Below is a demo, any suggestions?

// ---------------------------------------------------

import g4p\_controls.\*;

GTextField textfield1;  
GTextField textfield2;

public void setup(){  
size(480, 320, JAVA2D);  
G4P.messagesEnabled(false);  
G4P.setGlobalColorScheme(GCScheme.BLUE\_SCHEME);  
G4P.setMouseOverEnabled(false);  
surface.setTitle(“Sketch Window”);

textfield1 = new GTextField(this, 168, 145, 120, 30/_, G4P.SCROLLBARS\_HORIZONTAL\_ONLY_/);  
textfield1.setOpaque(true);  
textfield1.setText(“Opaque”);  
textfield1.setLocalColor(6, color(#ffffff));  
textfield1.setLocalColor(7, color(#000000));

textfield2 = new GTextField(this, 168, 185, 120, 30, G4P.SCROLLBARS\_HORIZONTAL\_ONLY);  
textfield2.setOpaque(true);  
textfield2.setLocalColor(6, color(#ffffff));  
textfield2.setLocalColor(7, color(#000000));  
}

public void draw(){  
background(#000000);  
}

---

<div class="post-metadata">

**Author:** ![quark](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quark/32/26_2.png) [@quark](https://discourse.processing.org/u/quark)\
**Post date:** [November 17, 2020, 4:08pm UTC](https://discourse.processing.org/t/g4p-gtextbox-border-issue/25490/2 "2020-11-17T16:08:07Z")

</div>

All G4P controls that have a UI (user interface) use an off-screen buffer to render the interface and then the buffer is copied to the specified area in the display. This is CPU efficient because the buffer is only updated if its state has changed since the previous frame.

So if we look at the statement  
`textfield1 = new GTextField(this, 168, 145, 120, 30);`  
The off-screen buffer is 120x30 pixels and the buffer is copied to location [168, 145] every frame.

Now some controls don’t use the entire buffer for its UI and any unused area is the background and its colour can be changed with something like  
`textfield1.setLocalColor(6, color(#ffffff));`

By default the background is always transparent, to make it visible we use  
`textfield1.setOpaque(true);`

The reason you don’t see the bottom line is because the typing area goes down to the bottom of the buffer - hence the background is not visible at the bottom.

**NOTE:** the GTextField control has _no border_ so the missing _line_ is not because part of a border is missing.

---

<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, 6:01pm UTC](https://discourse.processing.org/t/g4p-gtextbox-border-issue/25490/3 "2020-11-17T18:01:23Z")

</div>

I though it would be something like that.  
Thanks for the info.
