Two G4P GPanel questions (setTextAlign and resize)

I have two questions about the GPanel

one

According to the G4p reference GPanel is derived from GTextBase. The GTextBase class has a method setTextAlign but that does not seem to give the desired effect. I would like to horizontally centre the text in the tab.

import processing.javafx.*;
import g4p_controls.*;

void settings()
{
  // suppress windows scaling; see https://discourse.processing.org/t/windows-ui-scaling-not-respected/45905/5
  // note: System.setProperty("glass.win.uiScale", "1"); needs to be executed in setting, does not seem to have an effect in setup().
  System.setProperty("glass.win.uiScale", "1");
  size(800, 600, FX2D);
  smooth();
}

GPanel panel;

void setup()
{
  panel = new GPanel(this, 2, 2, 400, 300, "Hello");
  panel.setFont(new java.awt.Font("Calibri", java.awt.Font.PLAIN, 20));
  panel.setTextAlign(GAlign.RIGHT, GAlign.BOTTOM);
}

Am I doing something wrong? Or do I misunderstand the functionality?

two

I have a GPanel with a number of children. The last child is a label (to display an error message) is located at the bottom of the panel and will only show if an error message is displayed using setVisible(). I would like to know if it’s possible to resize a panel once it’s created; I could not find a method to achieve this.

The preferred layout would be
No error


Error (note the difference in height)

one
It’s not possible to set the text alignment in the panel bar. When the panel is collapsed the title bar shrinks which would require the text to move as well.

two
There are no public methods available to resize a control after it has been created.

Sorry that I can’t help but unfortunately it is not practical to provide all the functionality that might possibly be wanted.

1 Like

Thanks for the reply.

For the first one I wasn’t sure.
For the second one I did suspect that.