Skip to content

Fix the issue: When the windowY value exceeds the monitor height, set it to zero by default to ensure visibility. #283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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());
Expand Down