As always, thanks for the reply Matthias.
MatthiasM wrote:
A few things about singletons:
- you don't need a singleton - I suggest to stay away from static fields at all
There should only be one instance. Shouldn't I try to make sure it's never created twice?
Quote:
- don't use the double-checked locking for the singletons - Java has a much easier way to do that
How is that? I know it's outside the scope of this forum, so understand if you ignore this question

Quote:
- remember that TWL code is not thread safe (and OpenGL is basically only single threaded too)
Fair enough

Quote:
About making your window:
- don't call setSize() or setPosition() outside of layout() *except* for positioning the ResizableFrame itself
I don't know if I understand this. Do I do this when I create the ResizableFrame ? [ie. wss.setSize(100,100)].
If I override layout() I get weird behaviors.
Quote:
- you should probably make another subclass of Widget (or DialogLayout) which will hold your buttons & co and add that to the ResizableFrame (eg don't add your buttons & co directly to the ResizableFrame)
like this?
Code:
public class WindowSystemSettings extends ResizableFrame {
public WindowSystemSettings() {
setTitle("Settings");
setTheme("resizableframe-title");
add(new WindowSystemSettingsWidget());
this.setVisible(true);
}
@Override
public void layout() {
super.layout();
// won't resize if uncommented
//setSize(100,100);
}
public class WindowSystemSettingsWidget extends Widget {
public WindowSystemSettingsWidget() {
setTheme("");
Button button = new Button("[save]");
// Button is really small unless called.
// button.setSize(100, 100);
this.add(button);
}
}
}