# How to adjust tab size - GPanel - G4P library

**URL:** <https://discourse.processing.org/t/how-to-adjust-tab-size-gpanel-g4p-library/8285>\
**Category:** Libraries\
**Created:** [February 11, 2019, 6:24am UTC](https://discourse.processing.org/t/how-to-adjust-tab-size-gpanel-g4p-library/8285 "2019-02-11T06:24:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fvoiron](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@fvoiron](https://discourse.processing.org/u/fvoiron)\
**Post date:** [February 11, 2019, 6:24am UTC](https://discourse.processing.org/t/how-to-adjust-tab-size-gpanel-g4p-library/8285/1 "2019-02-11T06:24:54Z")

</div>

Is there any way to control the width of the tab of a GPanel / G4P library?  
Indeed when changing the font (setFont()) / or the text (setText()) set to the tab after creation of the GPanel, the tab width dosen’t resize properly by itself (tab ~couloured area left visible after the GPanel is collapsed). As a consequence a part of the text is displayed outside the tab area after the GPanel is collapsed.

When/how is this width calculated ~when calling constructor ? Is there any way to force the tab width ?

Also all specific characters (like - / + ~\_ etc…) seems not to be acounted. Is there any padding character that might be used to force larger width ?

Thanks for support !

---

<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:** [February 11, 2019, 6:41pm UTC](https://discourse.processing.org/t/how-to-adjust-tab-size-gpanel-g4p-library/8285/2 "2019-02-11T18:41:53Z")

</div>

Can you create a [MCVE](https://stackoverflow.com/help/mcve) to demonstrate the problem.

---

<div class="post-metadata">

**Author:** ![fvoiron](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@fvoiron](https://discourse.processing.org/u/fvoiron)\
**Post date:** [February 11, 2019, 7:37pm UTC](https://discourse.processing.org/t/how-to-adjust-tab-size-gpanel-g4p-library/8285/3 "2019-02-11T19:37:22Z")

</div>

Please find at the bottom of the EMail the MCVE.  
Also below a picture of the generated tab ==\> obviously the 3 last “BLA” characters are falling out of the red tab… thus my question ==\> how to extend the length of the red tab…

Thks

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/3/3056c7bcdbafcb482fdbdea85e811c88d48dffc4.png)

```auto
/////// this is the 
import g4p_controls.*;
import java.awt.Font;

Font fontA=new Font ("Arial Bold",Font.BOLD, 16);
GPanel CloudMan;

public void setup(){
   size(300, 300, P3D);
}

public void draw(){
  background(10);
  CloudMan = new GPanel(this, 20, 20, 250, 40, "");
  CloudMan.setCollapsed(true);
  CloudMan.setFont(fontA);
  CloudMan.setText("BLABLABLABLABLA");
  CloudMan.setLocalColorScheme(GCScheme.RED_SCHEME);

}

```

---

<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:** [February 11, 2019, 7:58pm UTC](https://discourse.processing.org/t/how-to-adjust-tab-size-gpanel-g4p-library/8285/4 "2019-02-11T19:58:10Z")

</div>

This appears to be a bug in G4P you can raise an issue on [SourceForge](https://sourceforge.net/p/g4p/tickets/) and I will fix it for the next version.

I should point out that G4P controls should not be created in draw() because this method renders the frames and is execiuted at 60 times a second. They should be created in setup like this.

```auto
import java.awt.Font;

Font fontA=new Font ("Arial Bold", Font.BOLD, 16);
GPanel CloudMan;

public void setup() {
  size(300, 300, P3D);
  CloudMan = new GPanel(this, 20, 20, 250, 40, "");
  CloudMan.setCollapsed(true);
  CloudMan.setFont(fontA);
  CloudMan.setText("BLABLABLABLABLA");
  CloudMan.setLocalColorScheme(GCScheme.RED_SCHEME);
}

public void draw() {
  background(10);
}

```

---

<div class="post-metadata">

**Author:** ![fvoiron](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@fvoiron](https://discourse.processing.org/u/fvoiron)\
**Post date:** [February 11, 2019, 8:19pm UTC](https://discourse.processing.org/t/how-to-adjust-tab-size-gpanel-g4p-library/8285/5 "2019-02-11T20:19:23Z")

</div>

Ok, I will report on source forge.

I noticed Indeed that creating panels in draw, crashes java. That s why…

Thanks Indeed for support

[Envoyé depuis Yahoo Mail pour Android](https://go.onelink.me/107872968?pid=InProduct&c=Global_Internal_YGrowth_AndroidEmailSig__AndroidUsers&af_wl=ym&af_sub1=Internal&af_sub2=Global_YGrowth&af_sub3=EmailSignature)
