Java examples for java.lang:Math Geometry
Returns the vertical sharing value If the value returned is negative, then the widgets are not in the same column
//package com.java2s; import java.awt.Rectangle; public class Main { /**//from w w w .ja v a 2 s .co m * Returns the vertical sharing value * If the value returned is negative, then the widgets are not in the same column */ public static int vSharingValue(Rectangle r1, Rectangle r2) { int d2 = Math.min((int) r1.getMaxX(), (int) r2.getMaxX()); int d1 = Math.max((int) r1.getMinX(), (int) r2.getMinX()); int d = d2 - d1 + 1; return d; } }