/** Determines if the given letter pair is a near-pair or a far-pair. */ public void setDistance() { int x = (kp2.getXPos() - kp1.getXPos()); x = x * x; int y = (kp2.getYPos() - kp1.getYPos()); y = y * y; double distance = Math.sqrt(x + y); if (distance > THRESHOLD) { dist = DISTANCE.FAR; } else { dist = DISTANCE.NEAR; } }