Java JFrame setFramePositon(JFrame inTargetFrame)

Here you can find the source of setFramePositon(JFrame inTargetFrame)

Description

set Frame Positon

License

Open Source License

Declaration

static void setFramePositon(JFrame inTargetFrame) 

Method Source Code


//package com.java2s;
import java.awt.Dimension;

import java.awt.Toolkit;

import javax.swing.JFrame;

public class Main {
    static void setFramePositon(JFrame inTargetFrame) {

        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension size = inTargetFrame.getSize();

        // (ulrivo): full size on screen with less than 640 width
        if (d.width >= 640) {
            inTargetFrame.setLocation((d.width - size.width) / 2, (d.height - size.height) / 2);
        } else {/*from   w w w.j a  v a  2  s .c om*/
            inTargetFrame.setLocation(0, 0);
            inTargetFrame.setSize(d);
        }
    }
}

Related

  1. setDirty(JFrame frame, boolean isDirty)
  2. setEscapeAction(JFrame frame, Action action)
  3. setEscapeClosable(JFrame frame)
  4. setESCCloseable(final JFrame aFrame)
  5. setFrameBottomRight(final JFrame frame)
  6. setFrameTitle(JFrame frame, File file)
  7. setGeneralParameters(final JFrame window)
  8. setInfo(String info, JFrame root)
  9. setJFrameAlwaysOnTop(JFrame frame, boolean newValue)