Skip to content

Commit

Permalink
Fix download progress window initializing the MainWindow class
Browse files Browse the repository at this point in the history
  • Loading branch information
tth05 committed May 1, 2022
1 parent 7713b1a commit 600a509
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void setLinkText(String text) {
public void setVisible(boolean b) {
super.setVisible(b);
if (b) {
UIUtils.centerJFrame(this);
UIUtils.centerJFrameOnScreen(this);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,10 @@ public static void centerJFrame(JFrame frame) {
var dim = gc.getBounds();
frame.setLocation(dim.x + (dim.width / 2 - frame.getSize().width / 2), dim.height / 2 - frame.getSize().height / 2);
}

public static void centerJFrameOnScreen(JFrame frame) {
var gc = frame.getGraphicsConfiguration();
var dim = gc.getBounds();
frame.setLocation(dim.width / 2 - frame.getSize().width / 2, dim.height / 2 - frame.getSize().height / 2);
}
}

0 comments on commit 600a509

Please sign in to comment.