Here you can find the source of centerFrame(JFrame frame)
Parameter | Description |
---|---|
JFrame | to be centered |
public static void centerFrame(JFrame frame)
//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); } }