Java JFrame Center centerFrame(JFrame frame)

Here you can find the source of centerFrame(JFrame frame)

Description

Centers a JFrame on the user's screen.

License

Open Source License

Parameter

Parameter Description
JFrame to be centered

Return

void

Declaration

public static void centerFrame(JFrame frame) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.swing.JFrame;

public class Main {
    /**/* w  w w.j a  va2  s .  c o  m*/
      * Centers a JFrame on the user's screen.
      * 
      * @param JFrame to be centered
      * @return void
      */
    public static void centerFrame(JFrame frame) {
        frame.setLocationRelativeTo(null);
    }
}

Related

  1. centerFrame(final JFrame target)
  2. centerFrame(JFrame frame)
  3. centerFrame(JFrame frame)
  4. centerFrame(JFrame frame)
  5. centerFrame(JFrame frame)
  6. centerFrame(JFrame frame)
  7. centerFrame(JFrame frame)
  8. centerFrame(JFrame frame, boolean isPopup)
  9. centerFrame(Window owner)