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 ?
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
/////// 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);
}
This appears to be a bug in G4P you can raise an issue on SourceForge 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.
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);
}