Java JFrame Center center(JFrame parent, JInternalFrame dialog)

Here you can find the source of center(JFrame parent, JInternalFrame dialog)

Description

Centers the supplied dialog in its parent's bounds.

License

Open Source License

Declaration

public static void center(JFrame parent, JInternalFrame dialog) 

Method Source Code

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

import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JInternalFrame;

public class Main {
    /**//from ww w  . j  a  v  a  2s .  c o  m
     * Centers the supplied dialog in its parent's bounds.
     */
    public static void center(JFrame parent, JInternalFrame dialog) {
        Dimension psize = parent.getSize();
        Dimension dsize = dialog.getSize();
        dialog.setLocation((psize.width - dsize.width) / 2, (psize.height - dsize.height) / 2);
    }
}

Related

  1. alignCenter(JInternalFrame internalFrame)
  2. center(JFrame frame)
  3. center(JFrame frame)
  4. centerAndSizeFrame(JFrame frame)
  5. centerBigFrame(JFrame frame, int maxWidth, int maxHeight, double scaling, int minHeight)
  6. centerDialog(final JFrame frame, JDialog dialog)
  7. centerDialog(JDialog dialog, JFrame frame)