svoid centerWindowWithin(Window w, Rect r) { if (w != null) swing { w.setLocation( r.x+(r.w-w.getWidth())/2, r.y+(r.h-w.getHeight())/2); } }