static Rectangle defaultNewFrameBounds_r = new Rectangle(300, 100, 500, 400); static Rectangle defaultNewFrameBounds() { ret swing(func -> Rectangle { defaultNewFrameBounds_r.translate(60, 20); var bounds = preferredScreenBounds(); if (!bounds.contains(defaultNewFrameBounds_r)) //defaultNewFrameBounds_r.setLocation(bounds.x+30+random(30), bounds.y+20+random(20)); defaultNewFrameBounds_r.setLocation(centerX(bounds)+random_incl(-30, 30), centerY(bounds)+random_incl(-20, 20)); ret new Rectangle(defaultNewFrameBounds_r); }); }