Java JFrame Center getCenteringFrame()

Here you can find the source of getCenteringFrame()

Description

get Centering Frame

License

Open Source License

Declaration

public static Frame getCenteringFrame() 

Method Source Code

//package com.java2s;
// it under the terms of the GNU General Public License as published by      //

import javax.swing.*;
import java.awt.*;

public class Main {
    private static JComponent COMPONENT = null;

    public static Frame getCenteringFrame() {
        for (Container c = COMPONENT; c != null; c = c.getParent()) {
            if (c instanceof Frame) {
                return (Frame) c;
            }/*from   ww w .  j av a 2s .  co  m*/
        }

        return null;
    }
}

Related

  1. centerWindow(JFrame window)
  2. centerWindowInFrame(Component window, Window frame)
  3. centerWindowOnParent(Window w, JFrame parent)
  4. centerWithinDesktop(JInternalFrame frame)
  5. createCenteredJFrame(String title, int width, int height, boolean autoclose)
  6. getCenterOfTheWindow(JFrame frame)
  7. placeInCenter(JFrame frame)
  8. posiToScreenCenter(JFrame frame)
  9. putWindowInCenter(JFrame window)