Login  Register

Setting proper window size with NEWT

Posted by zeeawk on Aug 11, 2012; 8:23am
URL: https://forum.jogamp.org/Setting-proper-window-size-with-NEWT-tp4025780.html

Whats the best way to set the window size using newt so everything fits on screen properly even if a task bar is displayed?
Would like to able to allow user to select alternate screen sizes also.

This is what my window code looks like right now:

windowHeight = 1024;
windowWidth  = 1280;
glp  = GLProfile.get(GLProfile.GL2);
caps = new GLCapabilities(glp);
window = GLWindow.create(caps);
window.setUndecorated(false);    
window.setSize(100,100);
window.setVisible(true);
// Set proper size
windowHeight -= window.getInsets().getTotalHeight();
windowWidth  -= window.getInsets().getTotalWidth();
window.setSize(windowWidth, windowHeight);
window.setTopLevelPosition(window.getScreen().getWidth()/2-windowWidth/2, 0);
window.requestFocus();

Thanks!