[SOLVED] How do I force a minimum window size in with LWJGL2?
jMonkeyEngine Hub
June 17, 2026
In case anyone needs something like this, I found a workable solution:
protected boolean forceMinimumResolution(int w, int h) {
int width = w;
int height = h;
if (width < settings.getMinWidth() || height < settings.getMinHeight()) {
int newWidth = Math.max(width, settings.getMinWidth());
int newHeight = Math.max(height, settings.getMinHeight());
settings.setResolution(newWidth, newHeight);
// For LWJGL2 Display
try {
org.lwjgl.opengl.Display.setDisplayMode(
new org.lwjgl.opengl.DisplayMode(newWidth, newHeight)
);
} catch (LWJGLException e) {
return false;
}
}
return true;
}
Discussion in the ATmosphere