Redraw components after resize
in
Contributed Library Questions
•
1 year ago
Hi all,
I am trying to make my application resizable. So I have put in: frame.setResizable(true);
Up to this point everything is okay. However, I am using controlP5 components which are defined as a class and created in setup by: guiInterface = new GUI(this);
When I resize, the texts from the components goes white and the location of components remains where it was before. So I was thinking that by detecting when there is a change in the window size I could simply recreate the interface based on the new window dimensions. Here is what I put into setup():
Regards,
Ali
I am trying to make my application resizable. So I have put in: frame.setResizable(true);
Up to this point everything is okay. However, I am using controlP5 components which are defined as a class and created in setup by: guiInterface = new GUI(this);
When I resize, the texts from the components goes white and the location of components remains where it was before. So I was thinking that by detecting when there is a change in the window size I could simply recreate the interface based on the new window dimensions. Here is what I put into setup():
- frame.addComponentListener(new ComponentAdapter() {
public void componentResized(ComponentEvent e) {
if(e.getSource()==frame) {
guiInterface = null;
guiInterface = new GUI(mainApp);
}
}
});
Regards,
Ali
1