diff --git a/src/main/java/com/tagtraum/perf/gcviewer/ctrl/impl/GCViewerGuiController.java b/src/main/java/com/tagtraum/perf/gcviewer/ctrl/impl/GCViewerGuiController.java index 13cf5901..3b94b944 100644 --- a/src/main/java/com/tagtraum/perf/gcviewer/ctrl/impl/GCViewerGuiController.java +++ b/src/main/java/com/tagtraum/perf/gcviewer/ctrl/impl/GCViewerGuiController.java @@ -38,8 +38,13 @@ void applyPreferences(GCViewerGui gui, GCPreferences preferences) { // TODO necessary? state is set above; no GCDocument open at this moment //viewMenuActionListener.actionPerformed(new ActionEvent(item, 0, item.getActionCommand())); } + + int windowY = preferences.getWindowY(); + int windowHeight = preferences.getWindowHeight(); + windowY = windowY > windowHeight? 0 :windowY; + gui.setBounds(preferences.getWindowX(), - preferences.getWindowY(), + windowY, preferences.getWindowWidth(), preferences.getWindowHeight()); String lastfile = preferences.getLastFile(); @@ -85,10 +90,16 @@ private GCPreferences copyPreferencesFromGui(GCViewerGui gui) { JCheckBoxMenuItem item = menuEntry.getValue(); preferences.setGcLineProperty(item.getActionCommand(), item.getState()); } + + + int windowY = preferences.getWindowY(); + int windowHeight = preferences.getWindowHeight(); + windowY = windowY > windowHeight? 0 :windowY; + preferences.setWindowWidth(gui.getWidth()); preferences.setWindowHeight(gui.getHeight()); preferences.setWindowX(gui.getX()); - preferences.setWindowY(gui.getY()); + preferences.setWindowY(windowY); OpenFile openFileAction = (OpenFile)gui.getActionMap().get(ActionCommands.OPEN_FILE.toString()); if (openFileAction.getLastSelectedFiles().length != 0) { preferences.setLastFile(openFileAction.getLastSelectedFiles()[0].getAbsolutePath());