Author: sletellier Date: 2010-11-09 17:38:36 +0100 (Tue, 09 Nov 2010) New Revision: 297 Url: http://nuiton.org/repositories/revision/nuiton-widgets/297 Log: #1022 SwingSession dont keep maximized frame Modified: trunk/src/main/java/org/nuiton/widget/SwingSession.java Modified: trunk/src/main/java/org/nuiton/widget/SwingSession.java =================================================================== --- trunk/src/main/java/org/nuiton/widget/SwingSession.java 2010-11-09 11:39:40 UTC (rev 296) +++ trunk/src/main/java/org/nuiton/widget/SwingSession.java 2010-11-09 16:38:36 UTC (rev 297) @@ -668,15 +668,17 @@ GraphicsConfiguration gc = c.getGraphicsConfiguration(); Rectangle gcBounds = (gc == null) ? null : gc.getBounds(); Rectangle frameBounds = c.getBounds(); + /* If this is a JFrame created by FrameView and it's been maximized, * retrieve the frame's normal (not maximized) bounds. More info: * see FrameStateListener#windowStateChanged in FrameView. */ if ((c instanceof JFrame) && (0 != (frameState & Frame.MAXIMIZED_BOTH))) { - frameBounds = getWindowNormalBounds((JFrame) c); + frameBounds = getWindowNormalBounds(c); } + WindowState result = null; - if (!frameBounds.isEmpty()) { + if (frameBounds != null && !frameBounds.isEmpty()) { result = new WindowState(); result.setBounds(frameBounds); result.setGcBounds(gcBounds); @@ -705,11 +707,10 @@ w.setSize(windowState.getBounds().getSize()); } } - if (w instanceof Frame) { - ((Frame) w).setExtendedState(windowState.getFrameState()); - - } } + if (w instanceof Frame) { + ((Frame) w).setExtendedState(windowState.getFrameState()); + } } }