Here you can find the source of centreOnScreen(Window frame)
Parameter | Description |
---|---|
frame | a parameter |
public static void centreOnScreen(Window frame)
//package com.java2s; //License from project: Open Source License import java.awt.Window; public class Main { /**//from ww w . j av a2 s . co m * Centres a window to screen * * @param frame */ public static void centreOnScreen(Window frame) { // Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); // int x = (int) ((dimension.getWidth() - frame.getWidth()) / 2.0D); // int y = (int) ((dimension.getHeight() - frame.getHeight()) / 2.0D); // frame.setLocation(x, y); frame.setLocationRelativeTo(null); } }