Here you can find the source of position(JFrame f)
Parameter | Description |
---|---|
f | The JFrame to be positioned. |
public static void position(JFrame f)
//package com.java2s; //License from project: Open Source License import javax.swing.*; public class Main { private static JFrame frame = null; /**//from w w w .ja v a 2 s. c o m * Centers a JFrame so that its position is in the center of * the window. * * @param f The JFrame to be positioned. */ public static void position(JFrame f) { f.setLocationRelativeTo(frame); } }