/* * MyCentralizedJDialog.java * * Created on November 18, 2004, 2:55 PM */ package cz.muni.fi.bronchus.gui; import javax.swing.*; import java.awt.*; /** * * @author xudrzal */ public class MyCentralizedJFrame extends javax.swing.JFrame { /** Creates a new instance of MyCentralizedJDialog */ public MyCentralizedJFrame() { super(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); centerInScreen(); } public void centerInScreen() { Dimension dim = this.getToolkit().getScreenSize(); Rectangle bounds = this.getBounds(); this.setLocation((dim.width - bounds.width) / 2, (dim.height - bounds.height) / 2); this.requestFocus(); } }