frame.setSize(800, 600);
frame.setVisible(true);
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
-
- centerFrameOnScreen(frame);
- }
-
- private void centerFrameOnScreen(JFrame frame) {
- final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
- frame.setLocation(
- (screenSize.width - frame.getWidth()) / 2,
- (screenSize.height - frame.getHeight()) / 2);
+ frame.setLocationRelativeTo(null); // center frame on screen
}
private TextArea getStackTraceView(Throwable cause) {