Java JFrame Center centerFrame(JFrame frame)

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

Description

center Frame

License

Open Source License

Declaration

public static void centerFrame(JFrame frame) 

Method Source Code


//package com.java2s;
import javax.swing.*;
import java.awt.*;

public class Main {
    public static void centerFrame(JFrame frame) {
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension frameSize = frame.getSize();
        frame.setLocation((screenSize.width / 2) - (frameSize.width / 2),
                (screenSize.height / 2) - (frameSize.height / 2));
    }//  w w  w .j  a v  a 2  s.  co  m
}

Related

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