Point loc = c.getLocation();
Rectangle bb = c.getBounds();
  private void componentMoved(Component c) {    if (c == this) return;      // Don't care about this    Point loc = c.getLocation();    Insets insets = this.getInsets();    int x = Math.max(0, Math.min(loc.x, this.getWidth() - insets.left - insets.right - M));    int y = Math.max(0, Math.min(loc.y, this.getHeight() - insets.top - insets.bottom - M));    if (loc.x > x || loc.y > y) {      c.setLocation(x, y);    }  }