/** * Set the full-screen state of the window. * * @param fullScreen <code>true</code> to set full-screen; <code>false</code> to exit full-screen */ void setFullScreen(boolean fullScreen) { HWND hWnd = getHWND(Native.getComponentID(window)); if (fullScreen) { windowState = getWindowState(hWnd); ExtendedUser32.INSTANCE.SetWindowLong( hWnd, GWL_STYLE, windowState.getStyle() & ~(WS_CAPTION | WS_THICKFRAME)); ExtendedUser32.INSTANCE.SetWindowLong( hWnd, GWL_EXSTYLE, windowState.getExStyle() & ~(WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE)); MONITORINFO monitorInfo = getMonitorInfo(hWnd); RECT rect = monitorInfo.rcMonitor; ExtendedUser32.INSTANCE.SetWindowPos( hWnd, null, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); } else { ExtendedUser32.INSTANCE.SetWindowLong(hWnd, GWL_STYLE, windowState.getStyle()); ExtendedUser32.INSTANCE.SetWindowLong(hWnd, GWL_EXSTYLE, windowState.getExStyle()); ExtendedUser32.INSTANCE.SetWindowPos( hWnd, null, windowState.getLeft(), windowState.getTop(), windowState.getRight() - windowState.getLeft(), windowState.getBottom() - windowState.getTop(), SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); if (windowState.getMaximized()) { ExtendedUser32.INSTANCE.SendMessage( hWnd, User32.WM_SYSCOMMAND, new WPARAM(WinUser.SC_MAXIMIZE), new LPARAM(0)); } } }