Skip to content

Commit

Permalink
window is positioned in the middle of the screen
Browse files Browse the repository at this point in the history
  • Loading branch information
etissieres committed Mar 9, 2014
1 parent bffb2c7 commit a48f514
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/java/org/mansart/mongocount/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.mansart.mongocount.gui.Window;

import javax.swing.*;
import java.awt.*;

public final class Application {

Expand Down Expand Up @@ -30,8 +31,12 @@ public void run() {
Window window = new Window(configuration, counter);
JFrame frame = new JFrame("Mongo Counter");
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.setSize(900, 600);
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation(
screen.width / 2 - frame.getSize().width / 2,
screen.height / 2 - frame.getSize().height / 2
);
frame.setContentPane(window);
frame.setVisible(true);
}
Expand Down

0 comments on commit a48f514

Please sign in to comment.