Java Rectangle resetPosition(Window window1, Window window2)

Here you can find the source of resetPosition(Window window1, Window window2)

Description

reset Position

License

Open Source License

Declaration

private static void resetPosition(Window window1, Window window2) 

Method Source Code


//package com.java2s;
import java.awt.Rectangle;
import java.awt.Window;

public class Main {
    private static void resetPosition(Window window1, Window window2) {
        Rectangle r1 = window1.getBounds();
        Rectangle r2 = window2.getBounds();
        int lowerEdge = (int) r2.getY() + (int) r2.getHeight();
        int rightEdge = (int) r2.getX() + (int) r2.getWidth();
        if ((int) r1.getY() < lowerEdge && (int) r1.getX() < rightEdge) {
            r1.setLocation((int) r1.getX(), lowerEdge);
            window1.setBounds(r1);//  w ww.j  a  v  a 2 s.  c  o  m
        }
    }
}

Related

  1. rectangleResize(Rectangle rect, int width, int height)
  2. rectCollide(final Rectangle a, final Rectangle b)
  3. rectDistance(final Rectangle r, final Rectangle q)
  4. rectFromArray(Rectangle2D aRectangle, double[] pts)
  5. rectFromRect2D(Rectangle2D rect)
  6. right(Rectangle r)
  7. size(final Component component)
  8. subdivide(Dimension dimension, int threshold, int max)
  9. subdivideRectangle(int width, int height, int numTilesX, int numTilesY, int extraBorder)