private void initComponents() { setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); messagePane.setBackground(contentPane.getBackground()); messagePane.setEditorKit(new HTMLEditorKit()); messagePane.setForeground(contentPane.getForeground()); setSize(450, 360); // center the window int x = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth() - getWidth()) / 2; int y = (int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight() - getHeight()) / 2; setLocation(x, y); okButton.addActionListener(this); }